Skip to content

search: factor out code for only doing unindexed search

Administrator requested to merge backend-dry-run/rvt/zlift-22 into main

Created by: rvantonder

Prep for a larger change. TL;DR this is a helper to basically defrag query/zoekt logic. I tried a lot of ways to chop up the problem and this is going to be the smoothest way. The second best alternative is inlining this logic in a bunch of callsites and updating accesses (super annoying).


Long explanation that I don't really recommend you read, unless you question whether I've thought about this and tried things:

Currently we convert a TextPatternInfo into a ZoektQuery, but we do this pretty deep in the call stack. We want to do this earlier, like in ToSearchInputs, for reasons https://github.com/sourcegraph/sourcegraph/pull/25556#discussion_r720034221. To make this happen, the call that constructs Zoekt queries search.QueryToZoektQuery needs to be lifted up through the calls. But that construction is predicated on some other logic. While it would be relatively safe to just temporarily lift up Zoekt query construction, it would be a bit incongruent with the logic (why check that Zoekt is active after we unconditionally convert a query?). But, this logic gets in the way of lifting out the query construction, due to its dependencies.

So, I'm constructing a helper function to capture that logic UseOnlyUnindexedSearchRequest, that I can lift out with everything else, instead of many lines of code that need all kinds of updating. It's temporary until I can lift everything into the early construction code.

Merge request reports

Loading