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

Hardcoded default limit of max 500 search results is not obvious #376

Closed
arknu opened this issue Feb 20, 2024 · 1 comment
Closed

Hardcoded default limit of max 500 search results is not obvious #376

arknu opened this issue Feb 20, 2024 · 1 comment
Labels

Comments

@arknu
Copy link

arknu commented Feb 20, 2024

I just had a strange issue where searching was returning unexpected results. Eventually, it turned out that Examine has a default hardcoded limit of only returning 500 search results:

public const int DefaultMaxResults = 500;

I would expect that not passing in QueryOptions would simply return all the results. If I want to limit the results, I'll pass in QueryOptions as appropriate.

I find the current behavior very strange and unintuitive. There is nothing in the API design to indicate that there is a limit, I had to check the source code to find out.

@Shazwazza
Copy link
Owner

The more results you try to return from Lucene, the higher the performance hit. This goes up exponentially. It is an anti-pattern to try to return all results. If you want to keep returning results, you should use Skip/Take and keep iterating. @nzdev has also added "deep paging" https://shazwazza.github.io/Examine/articles/paging.html#deep-paging for further performance improvements for this.

If you need more results than 500, use Skip/Take options but be advised that performance will degrade the more you try to load in a query (even if there aren't that many results).

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

No branches or pull requests

2 participants