API Reference / API Parameters / exactOnSingleWordQuery
Jan. 14, 2019

exactOnSingleWordQuery

Type: string
Engine default: attribute
Parameter syntax
'exactOnSingleWordQuery' => 'attribute'|'none'|'word'

Can be used in these methods:

About this parameter

Controls how the exact ranking criterion is computed when the query contains only one word.

Options:

  • attribute: (default): The exact ranking criterion is set to 1 if the query matches exactly an entire attribute value.

    For example, if you search for the TV show “Road”, and in your dataset you have 2 records, “Road” and “Road Trip”, only the record with “Road” will be considered exact.

  • none: The exact ranking criterion is ignored on single word queries.

  • word: The exact ranking criterion is set to 1 if the query word is found in the record. The query word must be at least 3 characters long and must not be a stop word in any supported language.

    For example, if you search for the TV show “Road”, and in your dataset you have 2 records, “Road” and “Road Trip”, both will be considered to match exactly.

Examples

Set default exact ranking criterion computation on single word query

1
2
3
4
5
$index->setSettings([
  'exactOnSingleWordQuery' => 'attribute'
  // 'exactOnSingleWordQuery' => 'none'
  // 'exactOnSingleWordQuery' => 'word'
]);
1
2
3
4
5
$results = $index->search('query', [
  'exactOnSingleWordQuery' => 'none'
  // 'exactOnSingleWordQuery' => 'attribute'
  // 'exactOnSingleWordQuery' => 'word'
]);

Did you find this page helpful?