Syntax help

(See also Search, Resultslist and Copyright and publication.)

You can use special query syntax to modify your search query.

Phrase search: "..."

It is possible to do a phrase search by putting the terms in "...". That way the exact order of the terms will be taken into account. A query for "paul baum" would return all records on the artist Paul Baum. While a query for paul baum (without quotation marks) would find both terms regardless of order. E.g., it would also find Paul Klee, Baum im Garten.

Wildcard search: * and ?

It is possible to mask parts of a word with the wildcard characters * or ?. The wildcard character can be placed at any position in the word. While the * can stand for an arbitrary number of characters (including zero), the ? replaces exactly one character. This is particularly useful if you're uncertain about one of the letters in your query term.

For instance, you're searching for records of van Gogh, but aren't sure about the spelling of his first name. Just enter Vin?ent van Gogh and the question mark will match the missing c.

A query for Sun* would find, e.g., Sun, Sunday, Sundown, etc. Sun*e would find, e.g., Sunrise, Sunshine, etc. *light would find, e.g., flight, redlight, etc.

Also refer to the Elasticsearch query string wildcard documentation for more information.

Fuzzy search: ~

It is possible to flag a word with ~ in the query to search for similar words. This is particularly useful if you're unsure about the spelling of a term or name. The ~ character will be positioned at the end of the word you want to search fuzzily. Note that the ~ doesn't replace parts of the word like the * does. E.g., a query for Jaqueometti~ Jaqueometti~ would not find the artist Giacometti, but *ometti would do so. But Gaugin~ would also return records for Gauguin, Gaudin, Baudin, etc.

Also refer to the Elasticsearch query string fuzziness documentation for more information.

Boosting: ^n

It is possible to attach ^n at the end of a word to influence ranking. n is an arbitrary positive number and only affects the ranking of the results list, not the number of the results returned. A query for gold OR silver^12 will prefer (= rank higher) all records which include silver, but nevertheless return those that match gold or gold and silver.

Also refer to the Elasticsearch query string boosting documentation for more information.

Boolean operators

It is possible to combine search clauses using the Boolean operators AND, OR, and AND NOT. They have the following meaning:

AND
Both search clauses must match.
OR
One of the search clauses must match, but it is also possible that both of them match.
AND NOT
The first search clause must match, but the second must not match.

For example, a query for artist = Picasso AND title = Stier would find all records of Bull images by Picasso. Whereas artist = Picasso AND NOT title = Stier would find all images by Picasso except his Bull images. On the other hand, artist = Picasso OR title = Stier would find all images by Picasso and all Bull images, regardless of the artist who painted them.

However, if you want to formulate a more sophisticated query that uses more than one operator you have to consider in what order they will be applied. The general order of precedence is as follows: OR > AND NOT > AND

That means, whenever you use a combination of them, OR will be evaluated before AND NOT which in turn will be evaluated before AND. Examples:

artist = Picasso AND title = Stier AND title = Pferd
Finds all images by Picasso that show both Bulls and Horses.
artist = Picasso AND title = Stier OR title = Pferd
Finds all images by Picasso that show either Bulls or Horses, or both.
artist = Picasso AND title = Stier AND NOT title = Pferd
Finds all images by Picasso that show Bulls, but no Horses.
artist = Picasso OR artist = van Gogh AND title = Stier OR title = Kuh
Finds all images by Picasso or by van Gogh that show either Bulls or Cows, or both.

Also refer to the Elasticsearch query string boolean operators documentation for more information.

Further information

Refer to the complete Elasticsearch query string documentation for even more details. The Wikipedia article Levenshtein distance has more information on the similarity measure used in Fuzzy search.