Search syntax
Since the quick search is based on Apache Lucene, it supports the same query/search syntax. The following chapters describe some basic use cases. If you are interested to learn about the query syntax in more detail, check the Apache Lucene documentation: https://lucene.apache.org/core/3_5_0/queryparsersyntax.html.
Terms
A query expression consists of terms and operators. There are two types of terms: single terms and phrases.
- A single term is a single word such as
test
orhello
. - A phrase is a group of words embedded in double quotes such as
hello dolly
.
Multiple terms can be combined with Boolean operators to perform a more complex query.
Boolean operators
Boolean operators make it possible to combine query terms by means of logic operators. These Boolean operators are supported:
AND
+
OR
NOT
-
Note that Boolean operators are always written as capitals.
The AND operator enables a search for entities that contain both search terms in any attribute or property.
Instead of AND, it is possible to use the symbol &&
.Example:
- To search for entities with both the terms
John
andTina
in any attribute or property value, use the search expressiontina AND john
ortina && john
. The OR operator links two terms. It finds a matching result if either of the search terms exists in an entity's attribute or property. The OR operator is the default operator. If a search expression does not contain a Boolean operator inbetween two terms, the system uses the OR operator.
Instead of OR, it is possible to use the symbol ||
.Examples:
To search for entities that contain either of the words
John
andTina
in any attribute or property value, search fortina OR john
ortina john
ortina || john
.To search for users whose first name is either
John
orTina
, use the search expressionfirstname:john OR firstname:tina
. The+
orrequired
operator requires that the term after the+
symbol exists somewhere in the entity's attributes or properties. Example:To search for entities with attribute or property values containing the word
John
, use the search expression+john
. The NOT operator excludes search results that contain the term after NOT in any attribute or property value. Note that the NOT operator cannot be used with just one term. For example, a search forNOT john
will return no results.
Instead of NOT, it is possible to use the symbol !
.Example:
To search for entities with the term
apple
but not the termJohn
in any attribute or property value, use the search expressionapple NOT john
. The-
orprohibit
operator excludes results that contain the term after the-
symbol in any attribute or property value. Example:To search for entities with attribute or property values containing the words
John
andTina
, but not the wordapple
, use the search expressionjohn tina –apple
.
Fuzzy search
The quick search feature supports fuzzy searches based on the Levenshtein Distance or Edit Distance algorithms. To perform a fuzzy search, use the tilde symbol ~
at the end of a single word term. For example, to search for a word similar in spelling to roam
, perform a fuzzy search with the search expression roam
. This results in matches that contain words like foam and roams.
Wildcard search
The quick search feature supports single and multiple character wildcard searches within single terms.
- To perform a single character wildcard search, use the
?
symbol. The single character wildcard search results in matches where the?
is replaced by a single character. E.g., a search forte?t
results in matches such astest
ortext
.
To perform a multiple character wildcard search, use the *
symbol.
Multiple character wildcard searches result in matches where the *
is replaced by one or more characters. E.g., a search for test*
results in matches such as test
, tests
or tester
. You can also use the *
symbol in the middle of a term, like te*t
. Note that you cannot use a *
or ?
symbol as the first character of a search.