Krugle Solr Search Syntax

The Solr search type supports a range of useful operators for prefix/suffix queries and boolean logic.


Keyword matching

Keywords can contain one or more terms with qualifiers:

filename:foo                       filename is foo
comment:bar                        term bar exists in a comment
comment:"foo bar"                  phrase foo bar exists in a comment
Boolean logic

Keywords can be combined as logical specifiers in the search specification:

filename:foo AND comment:"to do"   filename is foo and phrase to do exists in a comment
filename:foo -bar                  filename is foo and contents don't contain the term bar
filename:foo -comment:bar          filename is foo and comments don't contain the term bar
comment:("beta 1" OR "beta 2")     phrase beta 1 or beta 2 exists in a comment
Allowed characters

Any Unicode character may be used in terms, but certain characters are reserved and must be escaped. The Krugle Solr reserved characters are:

+ - && || ! ( ) { } [ ] ^ " ~ * ? : \ /

Any reserved character can be escaped with a backslash, e.g. \* to indicate that * is NOT a wildcard. This includes the backslash character itself, via \\

Additionally, any characters (except double quotes) are interpreted literally when surrounded by double quotes:

"john@solr-demo.com"
Wildcard matching

The asterisk symbol * can be used to represent any character or group of characters. WARNING: Wildcard searches that start with the wildcard symbol * can be very slow and should only be used when the results cannot be specified with other query options.

foo*      find terms that start with foo
*bar      find terms that end with bar
foo*bar   find terms that start with foo and end with bar
Proximity

The tilde symbol ~ can be used to find terms within a specified distance. Note that exact matches have proximity 0 and that word transpositions (bar foo instead of foo bar) have proximity 1:

"foo bar"     find foo immediately followed by bar (proximity 1 is the default)
"foo bar"~3   find matches where foo and bar are within 3 terms
Regular Expression

Enclosing the search query within slash characters/ / denotes that the pattern within the slashes is a regular expression. Note that the regular expression doesn't span across tokens

/foo*bar/     will find occurrences where the term starts with fo and is followed by 0 or more occurences of o followed by bar
/foo+bar/     will find occurrences where the term starts with fo and is followed by 1 or more occurences of o followed by bar

More details on the regular expression support can be found here.