[#1792] Fix bug with fields with more than 5000 values

Before, we tried to load 5000 values for every resource. If the resource had
more records than that, we simply ignored it. This meant the user couldn't add
filters to it anymore.

Now, instead of pre-loading the values, we simply get the field list and use
select2 to search the datastore when the user tries to add a filter. This means
that we now can handle resources of any size.

There're a few problems because `datastore_search` doesn't support returning
only DISTINCT values, so we have to do this on the client. It also messes with
the results in other ways. I created an issue #1815 to add this feature. When
that's done, we can improve this code.