Help
Searches use Elasticsearch Query String Query syntax, which is powerful and offers many features, at a modest cost in complexity and in fallible parsing – be sure to balance your parens and quotes.
FreshBSD will fall back to simplified query syntax in the event of a parse error.
Boolean Queries
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
.
Fuzzy queries
Suspect a term might be mistyped? Make it fuzzy - e.g. this should find ‘porcfs’:
procfs~
If it’s a bit too fuzzy, follow it by a number giving the desired edit distance (default is 2):
procfs~1
Fields
Commits are split into multiple searchable fields – by default only the commit message is searched, but you can include other fields as well.
message:foo branch:(bar OR baz)
Here’s a list of the current field names:
message
The commit message, default search field.
project
This is identified by a short tag for each project, as found in page URLs, such
as freebsd
, openbsd
, dfbsd
, openzfs
and so forth.
repository
The name of the repository, src
, ports
, doc
, etc.
source / src
A combination of project
and repository
joined with a /
. The project is
also a source
field, so source:freebsd
finds all FreeBSD commits, while
source:freebsd/src
finds only FreeBSD src commits.
committer, author
Name/username of the committer and author of a commit (usually the same).
commit
The commit identifier, such as the SVN revision number (without the leading r
),
a git hash, or a CVS commitid.
parents / parent
Parent commit hashes for a git repository.
merge
A boolean flag indicating a merge commit — currently only supported for git.
Normally you’d use the form filter, but you can also query directly:
merge:false
branches, tags / branch, tag
The list of branches and tags associated with a commit.
Note git has no direct concept of what branch a commit was made on - one is guessed
using git name-rev
.
date, commit_date, author_date
Dates associated with the commit, with date
being a combination of both fields.
filename, file.name, file.old_name, file.new_name
The list of filenames associated with a commit.
delta, additions, deletions, file_count
Number of lines added and removed in a commit, and the total number of files associated with a commit.
Range Queries
Fields containing dates and numbers can be filtered by ranges, for example commits which modified between 100 and 200 lines:
delta:[100 TO 200]
or:
delta:(>=100 <=200)
For exclusive ranges:
delta:{100 TO 200}
and obviously:
delta:(>100 <200)
An open-ended range can be used to set an upper or lower bound:
delta:[1000 TO *]
or:
delta:>=1000
Dates accept partial terms, so to find commits prior to 1999:
date:<1999
Or between Jan and March 2016:
commit_date:{2016-01 TO 2016-03}
Wildcards and Regexps
Yes, we have regexp search, but it may not work as you expect – ElasticSearch is not grep.
Modern search engines work using tokens, splitting text up into their constituent words and using those to perform queries. Regexps and patterns work on these tokens just like any other search.
For example:
mem*
Is roughly equivalent to a search query for every word in the database that starts
with mem
, ORed together.
Similarly:
str?cpy
Is like a search for strlcpy OR strncpy OR ...
.
Regex allows for more precise searches along the same lines:
/str[ln]cpy/
And more complex ones:
/(mem str[ln]?)cpy/
Try to avoid wildcards at the start, such as *cpy
– these require
ElasticSearch to scan every known token instead of only those starting with your
query, and are liable to fail with a timeout.