Focus point distance filter - #1323
Merged
Merged
Conversation
orangejulius
force-pushed
the
focus-point-distance-filter
branch
from
June 20, 2019 16:08
9a85b0c to
65b7b4c
Compare
Member
Author
orangejulius
force-pushed
the
focus-point-distance-filter
branch
from
June 22, 2019 00:54
65b7b4c to
4a21f92
Compare
orangejulius
force-pushed
the
focus-point-distance-filter
branch
from
July 17, 2019 13:41
6e69922 to
4b193d2
Compare
Member
Author
This change uses an extra filter clause that takes into account a focus point (if used) and the input text length to filter out very far away street and adress records, improving performance. Replaces #1215
orangejulius
force-pushed
the
focus-point-distance-filter
branch
from
July 19, 2019 16:33
4b193d2 to
17e2275
Compare
orangejulius
marked this pull request as ready for review
July 19, 2019 16:33
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.


This PR builds on the work in #1215 to improve the performance of autocomplete queries with the
focus.pointparameter, while ensuring the results are as similar as possible.It works by adding an Elasticsearch filter to autocomplete queries. Results must now pass one of the following tests to be scored and shown:
The allowed distance grows with the text length, and after some experimentation I settled on a hand tuned table of distances. As it stands the filter is active up to text lengths of 8, although the distance limit is a generous 2000km by then.
Currently, addresses and streets represent 565 million of the 605 million records in a full planet index, or about 93%. So in some cases this can filter out lots of results.
There are zero changes at all to either the acceptance tests or autocomplete acceptance tests, which hopefully confirms this change is pretty conservative. I feel like that's a great way for it to start out, and then we can tweak it more over time.
Potential future work
There are several things this PR doesn't try to tackle at all but that we should do in the future, using the groundwork laid here.
I actually really like the filter pattern used, with several clauses in the
shouldblock andminimum_should_matchset to one. This basically means we could easily add more conditions and as long as any one of them is true, the record will not be filtered outPopularity
Once we have more popularity values from work like pelias/openstreetmap#493 we could experiment with filtering out far away results below a popularity threshold. This would allow us to filter out some of the ~30 million venues, and possibly some of the 6.5M localities, currently in the index, providing another nice boost to performance.
Zoom
The example of searching for addresses in Australian coastal cities with a viewport centered on the middle of Australia was raised in pelias/pelias#658. This PR doesn't make that case worse, but it doesn't help either.
However, if we did introduce a zoom parameter, we could consider having it modify the distance limits so that the entire viewport was likely to be within that limit.