[#1792] Get only distinct values from the datastore

This code depends on code from pull request #1815.
[#1792] Limit to 20, instead of 100 results

We don't need that many results at once on a selectbox, and getting less means
a faster query and less data to transmit.