23

GitHub has a search system, building on elastic search that has many advanced features like searching for repositories or users. Using Google, I can search GitHub for alternatives. The search syntax of GitHub however only covers negation operator.

How do I use other logic operators in GitHub's search?

Is there perhaps a feature in elastic search that can be exploited for filtering or combining Boolean queries?

9

GitHub's built in search covers the and, not, and or operators, as well as various other comparisons. GitHub's general guidelines on searching are located here: https://help.github.com/articles/searching-github/

With its search syntax described here: https://help.github.com/articles/search-syntax/

  • 1
    Yes, AND, NOT and OR work now. Thanks for your answer! – Bengt Nov 10 '15 at 17:05
  • 22
    Nothing on those links explains how to use AND or OR, and they don't appear to work for me. – Christopher Sep 22 '17 at 22:00
12

The default search works as though there is an implied AND operator between each search key-value pair:

is:pr is:open author:monishdeb

If you specify more than one key-value pair for a key, it uses the last one, and suppresses earlier ones in the query when results are presented.

The advanced search works as though there is an implied OR operator between each search key-value pair:

author:monishdeb author:pradpnayak repo:civicrm/civicrm-core

There is no way to combine AND and OR operators that I have found. So I don't think it is possible to find open PRs from any of several authors for a single repo.

The NOT operator can be used to exclude strings: https://help.github.com/articles/understanding-the-search-syntax/

  • I was able to confirm that the GraphQL API search has an implicit OR between terms, at least when I searched for multiple repositories with repo: – Josh Dzielak Mar 10 at 13:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.