Info |
---|
Information valid from AMI version 8.0 initial release |
Summary
Product Search uses Elasticsearch's Query String to perform free-text search, as this allows fine control over the search using a basic Query String Syntax.
The table below lists the aspects of the Simple Query String Syntax that are supported (see the Elasticsearch Query String Syntax document for full details).
Table of Contents maxLevel 2
Feature | Character | Example | Description | |||
ORcanadian bacon | | | canadian OR bacon | By default multi-term searches are OR'd ORed together - i.e. find matches that contain either the word canadian OR the word bacon (in any order or position) | |||
ANDcanadian AND bacon | + | canadian && + bacon | Use if both terms are required (in any order or position) | |||
NOT | - | canadian AND + bacon NOT -film | Fuzziness | Use for words that must not be present | ||
Preferred | canadian +bacon | Use to specify that a term must be present - i.e the work bacon must be present, while the word candian is optional (but will increase relevancy if it is present) | ||||
Grouping | canadian AND (bacon OR ham) | Multiple terms or clauses can be grouped together with parentheses, to form sub-queries | ||||
Wildcards | qu?ck bro* | Wildcard searches can be run on individual terms, using ? to replace a single character, and * to replace zero or more characters | ||||
Regular Expressions | /joh?n(ath[oa]n)/ | Regular expression patterns can be embedded in the query string by wrapping them in forward-slashes | ||||
quikc~ brwn~ foks~Note that because multi-term searches are ORed, the example search would match values that either had canandian AND bacon OR did not have film. | ||||||
Phrases | " " | "canadian bacon" | Multiple words can be grouped together to form a phrase for searching | |||
Precedence | ( ) | (canadian american) + bacon | Signifies the precedence of matching operations | |||
Prefix Search | * | canad* | * at the end of a word signifies a prefix query | |||
Fuzziness | ~N | brwn~2 foks~2 | You can search for terms that are similar to, but not exactly like our search terms, using the “fuzzy” operator (~) | Boosting | quick^2 fox | You can use the boost operator (^) to make one term more relevant than anotherA number after the ~ sets the edit distance—the maximum number of characters that may be added to, removed from or substituted in a word to make a match. |
Slop amount | ~N | "canadian bacon"~2 | After a phrase, the maximum number of intervening unmatched words allowed to still make a match. In the example syntax, the query would match with: |
You can match any of these characters literally by preceding them with a \ backslash.