Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support search expressions #13126

Closed
4 of 5 tasks
rvantonder opened this issue Aug 19, 2020 · 1 comment
Closed
4 of 5 tasks

Support search expressions #13126

rvantonder opened this issue Aug 19, 2020 · 1 comment
Assignees

Comments

@rvantonder
Copy link
Contributor

rvantonder commented Aug 19, 2020

Search expressions allows composing various filters and search patterns using and and or expressions. Previous requests and GH issues refer to a rich history of terminology, like "nested search" and "hierarchical search" #1005 #636. These terms mean different things in various contexts, but don't really define a language or semantics, only a high level desired behavior and proposed syntax. The prior discussions or proposals make it hard to concretely implement a spec for what has been called "nested search" and "hierarchical search". So, I am going to avoid that terminology and instead refer to search expressions, which have a concrete spec based on our grammar and search capabilities. Search expressions implement a set of operations that satisfy some (but not necessarily all) of the high level behavior described previously for "nested" and "hierarchical" search. Search expressions in their current form can be extended to satisfy all of the previously described behavior, subject to additional syntax and evaluation logic.

Search expressions simply mean that we can compose (or combine) various filters and search patterns with our current set of operators: and and or. For example, it supports expressing queries like:

  • (repo:foo or repo:bar) (baz and qux)
  • (repo:foo (file:bar or file:baz) qux) or (repo:foobar file:barfoo bazfoo)
  • (type:commit or type:diff) my commit

Expressions can be nested and parenthesized group imply scope for certain filters (e.g., repo: scopes file: or search patterns). Nested expressions may also be called subqueries.

This issue tracks the implementation for supporting search expressions.

file:bar baz or qux

mean that file:bar scopes both of baz or qux, or only baz? The grammar by default does the latter, but we do perform heuristics for the former. One possibility is to define a scoping rule that is left-to-right for repo:, file:, and patterns, but this implies that order of parameters is significant and should be preserved, which could be a significant change.


Search expressions are a generalization of work on related issues for and/or operators captured in #11009 #10623 #7823

@rvantonder
Copy link
Contributor Author

Done.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
No open projects
Search iterations
  
Planned
Development

No branches or pull requests

1 participant