Skip to content

search: clamp lucky search runs

Administrator requested to merge rvt/lucky-clamp into main

Created by: rvantonder

I was getting ready to launch internally but noticed that we basically always run at least one generated search up to the result threshold. Instead, we should only be initiating generated search below the result threshold.

This PR sets the result threshold to the streaming default. The threshold only determines whether generated searches should run at all, so for now it can be hardcoded and not, e.g., rely on count:value. This means that if count:value in the original query is greater than RESULT_THRESHOLD, the query effectively turns off lucky search, which is probably not a bad side effect for things like global queries that do count:all. I was doing global queries when I noticed I didn't properly clamp results on the original query...

Maybe there are better ways to do this, but again this seems adequate and I'm eager to launch internally.

Test plan

Added a test.

Merge request reports

Loading