searchableAttributes
'restrictSearchableAttributes' => [ 'attribute' ]
Can be used in these methods:
search,
browseObjects,
searchForFacetValues,
generateSecuredApiKey,
addApiKey,
updateApiKey
search,
browse,
search_for_facet_values,
generate_secured_api_key,
add_api_key,
update_api_key
search,
browse,
searchForFacetValues,
generateSecuredApiKey,
addApiKey,
updateApiKey
search,
browse_objects,
search_for_facet_values,
generate_secured_api_key,
add_api_key,
update_api_key
search,
browse,
searchForFacetValues
search,
browseObjects,
searchForFacetValues,
generateSecuredApiKey,
addApiKey,
updateApiKey
searchAsync,
browseAsync,
searchForFacetValues
Search,
Browse,
SearchForFacetValues,
GenerateSecuredApiKey,
AddApiKey,
UpdateApiKey
Search,
browse,
searchForFacetValues,
generateSecuredApiKey,
addApiKey,
updateApiKey
Search,
BrowseObjects,
SearchForFacetValues,
GenerateSecuredAPIKey,
AddAPIKey,
UpdateAPIKey
search,
browse index,
search into facet values,
generateSecuredApiKey,
add key,
update key
About this parameter#
Restricts a given query to look in only a subset of your searchable attributes.
This setting overrides searchableAttributes for specific searches.
Usage notes:#
- This setting is a query-level setting, affecting only the search that specifies it.
searchableAttributes
must not be empty nor null forrestrictSearchableAttributes
to be applied.
Examples#
Search on a restricted set of attributes#
In this example let’s consider that searchableAttributes are set to:
['title', 'author', 'publisher', 'content']
but we want to only search in title
and author
1
2
3
4
5
6
$results = $index->search('query', [
'restrictSearchableAttributes' => [
'title',
'author'
]
]);