By definition, all boundary.country query matches will either be
identical, or not a match. Thus, it does not make sense to put the query
clause for boundary.country in the `must` section of the query.
In theory, because our queries would generally combine this `must`
clause with others, there shouldn't be any performance improvement (or
regression) from this change.
However, semantically, this clause fits better as a `filter`, and in the
case of a bug causing a degenerate query with the `boundary.country`
query clause as the only one under the `must` section, this would have a
big impact.
This was missed by me when working on https://github.com/pelias/api/pull/580, but caught by the acceptance tests!
Unfortunately it was caught after going to production.
Using the check-types module, check that lat/lon values are numbers,
instead of checking their truthyness, to ensure that queries for null
island work correctly.
query/sort.js
-Use the elasticsearch script introduced in
https://github.com/pelias/scripts/pull/7 to boost results with
exact text matches when documents' `_score`s are tied.
-Make `query/sort` export a function that creates the `sort`
query component, rather than the query component as a singleton,
to allow it to optionally add the exact-match script (that is,
when an `input` is present in `params`).