Thanks to its powerful backend, Portrait can use operators to extend the possibilities of a search.
Operators
The following operators can be used inside Portrait:
Op. | Description | Example |
---|---|---|
| signifies AND operation. | Vienna +Orchestra |
| signifies OR operation | Vienna | Salzburg |
| negates a single term | Orchestra -Vienna |
| wraps a number of terms to signify a phrase for searching | “Vienna Philarmonic Orchestra” |
| at the end of a term signifies a prefix query | Vie* |
| signify precedence | Orchestra (Salzburg | Vienna) |
| after a word signifies edit distance (fuzziness) | Vienne~1 See below “Fuzziness” |
| after a phrase signifies slop amount | “Vienna Centre“~3 See below “Slop value” |
In order to search for any of these special characters, they will need to be escaped with \
. E.g: C\+\+
.
By default terms are connected by AND; so you don’t need to use the operator +
in practice.
Fuzziness
A fuzzy search will return a list of results based on likely relevance even though search argument words and spellings may not exactly match. Exact and highly relevant matches appear near the top of the list.
Example: Vienne~1 will also find “Vienna”.
The value can be at maximum 3
. This is very useful if you do not the exact spelling of a word - e.g. “Mayer”, “Maier” or “Meyer”.
Slop value
The slop
parameter tells the query how far apart terms are allowed to be while still considering the document a match. By how far apart we mean how many times do you need to move a term in order to make the query and document match?
Example: “Vienna Centre”~3
will find the phrase “Vienna International Centre“.
Read more about it here: https://www.elastic.co/guide/en/elasticsearch/guide/current/slop.html