Nested searches
Created by: sqs
NOTE: See https://github.com/sourcegraph/sourcegraph/issues/1005#issuecomment-473011076 for the latest update on this issue.
Also known as subquery search. This is about improving the power of search in
Sourcegraph via adding sub-queries and logical operators (AND, OR, NOT). These
sort of queries are not uncommon via the shell. Usually done by mixing shell
pipelines, find
, grep -L
and grep -l
. Examples of things you can achieve:
- Make it possible to find all repositories which do not contain a Dockerfile.
- Make it possible to find results which match X, but only if the repository contains the word Y.
- Make it possible to find results which match X, but only if the file contains the word Y.
Here are some example queries in our proposed syntax to achieve the above:
type:repo f:Dockerfile
type:repo -f:Dockerfile
(type:repo langserver) cxp
(type:file Copyright) Redistribution
(type:repo (file:^license or file:readme) BSD) (type:repo (type:file -f:Dockerfile)) test
Alternate syntax proposed in https://github.com/sourcegraph/sourcegraph/issues/4774
Roadmap
-
support type:repo and type:file in zoekt - done -
search providers - done -
nested queries in searcher - done -
split search into pkgs for code coverage stats #3566 (closed) -
add integration test harness of search in a single process #3475 (closed) -
add integration tests for all customer requested nested search functionality #3531 (closed) -
fix any existing breakage found by the new integration tests #3532 (closed) -
performance testing and tuning of searcher -
add endpoint showing top recent queries #3256 (closed) -
add tool or endpoint to generate a report comparing performance of search with and without nesting enabled for non-indexed search #2879 (closed) -
make non-indexed search perform as well with nesting enabled as without #3497 (closed)
-
-
use the nested query parser for all queries, translating them to old-style query structures behind the scenes #3495 (closed) -
use the data obtained from #3256 (closed) to ensure most common queries give the same results as before -
feature parity for repo queries (forked, archive, repogroups) -
backwards compatibility with diff search -
update UI to use new syntax (eg how to specify refs ) -
update sample (saved) queries -
update documentation
Closes:
Customers: