exactOnSingleWordQuery
'exactOnSingleWordQuery' => 'attribute'|'none'|'word'
Can be used in these methods:
search,
setSettings,
browseObjects,
searchForFacetValues,
generateSecuredApiKey,
addApiKey,
updateApiKey
search,
set_settings,
browse_objects,
search_for_facet_values,
generate_secured_api_key,
add_api_key,
update_api_key
search,
setSettings,
browseObjects,
searchForFacetValues,
generateSecuredApiKey,
addApiKey,
updateApiKey
search,
set_settings,
browse_objects,
search_for_facet_values,
generate_secured_api_key,
add_api_key,
update_api_key
search,
setSettings,
browse,
searchForFacetValues,
generateSecuredApiKey,
addAPIKey,
updateAPIKey
search,
setSettings,
browseObjects,
searchForFacetValues,
generateSecuredApiKey,
addApiKey,
updateApiKey
Search,
SetSettings,
Browse,
SearchForFacetValues,
GenerateSecuredApiKey,
AddApiKey,
UpdateApiKey
Search,
setSettings,
browse,
searchForFacetValues,
generateSecuredApiKey,
addApiKey,
updateApiKey
Search,
SetSettings,
BrowseObjects,
SearchForFacetValues,
GenerateSecuredAPIKey,
AddAPIKey,
UpdateAPIKey
search,
setSettings,
browse index,
search into facet values,
generateSecuredApiKey,
add key,
update key
About this parameter
Controls how the exact
ranking criterion is computed when the query contains only one word.
Usage notes
If exactOnSingleWordQuery
is set to word
, only exact matches will be highlighted in the _highlightResult
property of the search response: partials and prefixes will not be.
Options
|
(default): The 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” is considered exact. |
|
The |
|
The Continuing with our “Road” TV show example, in this case, both “Road” and “Road Trip” are 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'
]);
Override default exact ranking criterion computation on single word query for the current search
1
2
3
4
5
$results = $index->search('query', [
'exactOnSingleWordQuery' => 'none'
// 'exactOnSingleWordQuery' => 'attribute'
// 'exactOnSingleWordQuery' => 'word'
]);