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" or "hello".
- 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.AND operator 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" and "Tina" in any attribute or property value, use the search expression "tina AND john" or "tina && 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" and "Tina" in any attribute or property value, search for "tina OR john" or "tina john" or "tina || john".
To search for users whose first name is either "John" or "Tina", use the search expression "firstname:john OR firstname:tina". The "+" or "required" 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 for "NOT 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 term "John"in any attribute or property value, use the search expression "apple NOT john". The "-" or "prohibit" 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" and "Tina", but not the word "apple", use the search expression "john 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 for"te?t" results in matches such as "test" or "text".
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
testresults in matches such as "test", "tests" or "tester". You can also use the "" symbol in the middle of a term, like
tet. Note that you cannot use a
or
?` symbol as the first character of a search.*