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

Don't allow unbounded search queries #762

Open
WadeBarnes opened this issue Oct 19, 2023 · 3 comments
Open

Don't allow unbounded search queries #762

WadeBarnes opened this issue Oct 19, 2023 · 3 comments

Comments

@WadeBarnes
Copy link
Member

WadeBarnes commented Oct 19, 2023

Unbounded queries are end up querying/fetching millions of records, and overwhelming the search-engine.

Examples of some unbounded queries can be found in the orgbook-configurations ./manage script; https://github.com/bcgov/orgbook-configurations/pull/137/files#diff-63baa3a336ec0b711e0cbe2e1015954578737523843dd17f6ddaed70d50f027f

@swcurran
Copy link
Contributor

Can you define what unbounded means in this context? Is there a valid use case for the UI to use these queries?

@WadeBarnes
Copy link
Member Author

WadeBarnes commented Oct 19, 2023

Here is an example from the script:

https://orgbook.gov.bc.ca/api/v4/search/credential?format=json&ordering=-score&page=248818

Unbounded in this context means the search does not contain a query parameter that narrows the scope of the search. On the search engine side such a search can return >1 million hits, and then the API filters the results into a subset and limits the number of records returned to the user.

These types of queries do not come from the UI, they are coming from outside sources querying the API directly.

Though the UI does allow wild card queries that have similar results like this one:

https://orgbook.gov.bc.ca/api/v4/search/topic/facets?q=*&inactive=&category:entity_type=&credential_type_id=&page=1&revoked=false

Which basically returns everything:
image

@WadeBarnes
Copy link
Member Author

Since adding support in the proxy to block unbounded search queries, we have not had any issues with SOLR. This clearly indicates it's the query construction that was the issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Assignment Ready
Development

No branches or pull requests

2 participants