Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Speed up country search #3292

Merged
merged 3 commits into from
Jan 7, 2024
Merged

Conversation

lonvia
Copy link
Member

@lonvia lonvia commented Jan 7, 2024

Searches for a country name are fairly expensive because country names tend to appear in lots of POIs (e.g. "embassy of Norway"). These results will be immediately discarded because of their low importance but Postgres still needs to go through all of them and, more importantly, compute their penalty with respect to the search terms.

This change restricts further SQL search queries to ranks 5 - 25 after a country result has been found. This means that a large part of results can get filtered before sorting (and thus penalty computation). It should not have any effects on the outcome of searches because country searches are only executed when nothing but the country name is found in the query.

lonvia added 3 commits January 7, 2024 15:28
A country search result usually comes with a very high importance.
As a result only other very well known places will show up together
with country results and that means only places with lower address
ranks. Name searches for country names tend to yield a lot of POI
results because the country name is part of the name
(think "embassy of Sweden"). By excluding POIs from further searches,
the search is sped up quite a bit.
@lonvia lonvia merged commit d35eb41 into osm-search:master Jan 7, 2024
9 checks passed
@lonvia lonvia deleted the faster-country-search branch January 7, 2024 19:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant