Skip to content

extensibility: add query transformers to streaming search

Administrator requested to merge tjk/restore-query-transformers into main

Created by: tjkandala

Closes #19237.

Adds support for QueryTransformers (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/replace patternType 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, determining patternType will be tough/naive (e.g. "patternType:regexp test" patternType:literal)

Screenshot of go-imports-search working: Screenshot from 2021-08-31 18-22-21

Merge request reports

Loading