queryOptions
Configures options for the query parser specified in the queryParser parameter. You specify the options in JSON using the following form {"OPTION1":"VALUE1","OPTION2":VALUE2"..."OPTIONN":"VALUEN"}.
The options you can configure vary according to which parser you use:
defaultOperator: The default operator used to combine individual terms in the search string. For example:defaultOperator: 'or'. For thedismaxparser, you specify a percentage that represents the percentage of terms in the search string (rounded down) that must match, rather than a default operator. A value of0%is the equivalent to OR, and a value of100%is equivalent to AND. The percentage must be specified as a value in the range 0-100 followed by the percent (%) symbol. For example,defaultOperator: 50%. Valid values:and,or, a percentage in the range 0%-100% (dismax). Default:and(simple,structured,lucene) or100(dismax). Valid for:simple,structured,lucene, anddismax.fields: An array of the fields to search when no fields are specified in a search. If no fields are specified in a search and this option is not specified, all text and text-array fields are searched. You can specify a weight for each field to control the relative importance of each field when Amazon CloudSearch calculates relevance scores. To specify a field weight, append a caret (^) symbol and the weight to the field name. For example, to boost the importance of thetitlefield over thedescriptionfield you could specify:"fields":["title^5","description"]. Valid values: The name of any configured field and an optional numeric value greater than zero. Default: Alltextandtext-arrayfields. Valid for:simple,structured,lucene, anddismax.operators: An array of the operators or special characters you want to disable for the simple query parser. If you disable theand,or, ornotoperators, the corresponding operators (+,|,-) have no special meaning and are dropped from the search string. Similarly, disablingprefixdisables the wildcard operator (*) and disablingphrasedisables the ability to search for phrases by enclosing phrases in double quotes. Disabling precedence disables the ability to control order of precedence using parentheses. Disablingneardisables the ability to use the ~ operator to perform a sloppy phrase search. Disabling thefuzzyoperator disables the ability to use the ~ operator to perform a fuzzy search.escapedisables the ability to use a backslash (\) to escape special characters within the search string. Disabling whitespace is an advanced option that prevents the parser from tokenizing on whitespace, which can be useful for Vietnamese. (It prevents Vietnamese words from being split incorrectly.) For example, you could disable all operators other than the phrase operator to support just simple term and phrase queries:"operators":["and","not","or", "prefix"]. Valid values:and,escape,fuzzy,near,not,or,phrase,precedence,prefix,whitespace. Default: All operators and special characters are enabled. Valid for:simple.phraseFields: An array of thetextortext-arrayfields you want to use for phrase searches. When the terms in the search string appear in close proximity within a field, the field scores higher. You can specify a weight for each field to boost that score. ThephraseSlopoption controls how much the matches can deviate from the search string and still be boosted. To specify a field weight, append a caret (^) symbol and the weight to the field name. For example, to boost phrase matches in thetitlefield over theabstractfield, you could specify:"phraseFields":["title^3", "plot"]Valid values: The name of anytextortext-arrayfield and an optional numeric value greater than zero. Default: No fields. If you don't specify any fields withphraseFields, proximity scoring is disabled even ifphraseSlopis specified. Valid for:dismax.phraseSlop: An integer value that specifies how much matches can deviate from the search phrase and still be boosted according to the weights specified in thephraseFieldsoption; for example,phraseSlop: 2. You must also specifyphraseFieldsto enable proximity scoring. Valid values: positive integers. Default: 0. Valid for:dismax.explicitPhraseSlop: An integer value that specifies how much a match can deviate from the search phrase when the phrase is enclosed in double quotes in the search string. (Phrases that exceed this proximity distance are not considered a match.) For example, to specify a slop of three for dismax phrase queries, you would specify"explicitPhraseSlop":3. Valid values: positive integers. Default: 0. Valid for:dismax.tieBreaker: When a term in the search string is found in a document's field, a score is calculated for that field based on how common the word is in that field compared to other documents. If the term occurs in multiple fields within a document, by default only the highest scoring field contributes to the document's overall score. You can specify atieBreakervalue to enable the matches in lower-scoring fields to contribute to the document's score. That way, if two documents have the same max field score for a particular term, the score for the document that has matches in more fields will be higher. The formula for calculating the score with a tieBreaker is(max field score) + (tieBreaker) * (sum of the scores for the rest of the matching fields). SettieBreakerto 0 to disregard all but the highest scoring field (pure max):"tieBreaker":0. Set to 1 to sum the scores from all fields (pure sum):"tieBreaker":1. Valid values: 0.0 to 1.0. Default: 0.0. Valid for:dismax.