extensibility: add query transformers to streaming search
Created by: tjkandala
Closes #19237 (closed).
Adds support for QueryTransformer
s (API: sourcegraph.search.registerQueryTransformer
) to streaming search. They were integrated with "old" search, but not carried over to streaming search. We waited until extension loading performance improved to restore them in order to limit impact on initial search performance.
Notes:
- Unlike the original implementation, search queries are not re-computed + executed when new query transformers are registered. In practice, this shouldn't matter as long we wait for the initial set of extensions to load (query transformer extensions should always be active, not waiting for files of a language)
- Performance impact: initial search is blocked on extension activation, imperceptible cost for subsequent searches. The
graphql?Extensions
query is the bottleneck right now, but there are multiple PRs aiming to fix that: caching, speeding up request.
TODO
- I've modernized our query transformer extensions, but they don't work by default with search V2 (?) since it defaults to literal search. Should we try to check
patternType
and add/replacepatternType
in each extension, or just tell users in READMEs that they should be in regexp mode? I know that without using the query parser from the main repo, determiningpatternType
will be tough/naive (e.g."patternType:regexp test" patternType:literal
)