Searches use Elasticsearch Query String Query syntax - it's quite powerful, but also a bit fiddly. You're techy people, I'm sure you'll manage. It's unforgiving of errors, so be sure to balance your parens and quote.
Terms are ANDed together by default. You can OR them:
foo OR bar
Or negate them:
foo NOT bar
And you can group terms together to make more complex queries:
(foo OR bar) NOT moo
-moo is a synonym for NOT moo.
Suspect a term might be mistyped? Make it fuzzy - e.g. this should find 'porcfs':
If it's a bit too fuzzy, follow it by a number giving the desired edit distance (default is 2):
Commits are split into multiple fields. By default they're all searched, with the commit message getting the highest relevance (if you're sorting by that).
This means you can get results that match only on filename, which can be a bit useless. I might change this at some point, but either way you can always be explicit:
message:foo branch:(bar OR baz)
Here's a list of the current field names:
- freebsd, openbsd, netbsd, dfbsd, etc
- Name of the repository. src, ports, etc
- Commit ID - a (stringified) integer for SVN, a hash for git, a commitid for CVS.
- tree, parents
- Git only, hashes for the tree and parents.
- committer, author
- Name of the committer and author.
- Commit message.
- branches, tags
- A list of branches and tags associated with a commit.
- The number of files in a commit. Might be useful when combined with range searches.
- delta, additions, deletions
- The number of lines added and deleted in the commit. Delta is a total.
- date, commit_date, author_date
- Date is a combination of both fields. Again, useful with range searches.
- filename, file.name, file.old_name, file.new_name
- The old and new name, and the old *or* new name.
- file.version, file.status, file.delta, file.additions, file.deletions
- These are actually pretty useless most of the time, because ElasticSearch doesn't associate them with a single object. e.g. you can't ask for a specific file with a specific CVS revision. They exist anyway, for now at least.
Say you want to see all commits that modified between 100 and 200 lines:
delta:[100 TO 200] OR delta:(>=100 <=200)
Or any with more than 1,000:
delta:[1000 TO *] OR delta:>=1000
Or commits before 1999:
commit_date:[* TO 1999] OR date:<=1999
Or commits Jan - March 2016:
commit_date:[2016-01 TO 2016-03]
Date searches with incomplete dates produce implicit range searches, so this gives all commits dated March 2016:
Wildcards and Regexps
* matches any number of characters, ? matches one. Not these are matching on tokens (i.e. individual words) and not the raw text.
Try to keep your wildcard to the right of each term. Searching for | mem* is vastly more efficient than searching for | *cpy.
Find messages that contain tokens starting with 'mem':
Find commits mentioning SSE1, 2, 3, etc:
You can also use regexp to make it more specific:
Find memcpy, strcpy, strlcpy and strncpy: