View API Reference

API Parameters

Scope

Each parameter in this page has a scope. Depending on the scope, you can use the parameter within the `setSettings` and/or the `search` method.

There are three scopes:

  • settings: The setting can only be used in the setSettings method.
  • search: The setting can only be used in the search method.
  • settings search: The setting can be used in the setSettings method and be overridden in the searchsearch` method.

Parameters list

query
search
The text to search for in the index.

Attributes

searchableAttributes
settings
List of attributes eligible for textual search.
attributesForFaceting
settings
List of attributes you want to use for faceting.
unretrievableAttributes
settings
List of attributes that cannot be retrieved at query time.
attributesToRetrieve
settings search
List of object attributes you want to retrieve.
restrictSearchableAttributes
search
List of attributes to be considered for textual search.

Ranking

ranking
settings
Controls the way results are sorted.
customRanking
settings
Specifies the `custom` ranking criterion.
replicas
settings
List of indices to which you want to replicate all write operations.

Filtering / Faceting

filters
search
Filter the query with numeric, facet and/or tag filters.
facets
search
Facets to retrieve.
maxValuesPerFacet
settings search
Maximum number of facet values returned for each facet.
facetFilters
search
Filter hits by facet value.
facetingAfterDistinct
search
Force faceting to be applied after de-duplication.
optionalFilters
search
Create filters for ranking purposes, to rank higher records that contain the filter(s)
sumOrFiltersScores
search
Determines how to calculate the total score for filtering

Highlighting / Snippeting

attributesToHighlight
settings search
List of attributes to highlight.
attributesToSnippet
settings search
List of attributes to snippet, with an optional maximum number of words to snippet.
highlightPreTag
settings search
String inserted before highlighted parts in highlight and snippet results.
highlightPostTag
settings search
String inserted after highlighted parts in highlight and snippet results.
snippetEllipsisText
settings search
String used as an ellipsis indicator when a snippet is truncated.
restrictHighlightAndSnippetArrays
settings search
Restrict arrays in highlight and snippet results to items that matched the query.

Pagination

page
search
Number of the page to retrieve.
hitsPerPage
settings search
Maximum number of hits per page.
offset
search
Offset of the first hit to return (zero-based).
length
search
Maximum number of hits to return. (1000 is the maximum)
paginationLimitedTo
settings
Maximum number of hits accessible via pagination.

Typos

minWordSizefor1Typo
settings search
Minimum number of characters a word in the query string must contain to accept matches with one typo.
minWordSizefor2Typos
settings search
Minimum number of characters a word in the query string must contain to accept matches with two typos.
typoTolerance
settings search
Controls whether typo tolerance is enabled and how it is applied:
allowTyposOnNumericTokens
settings search
Whether to allow typos on numbers ("numeric tokens") in the query string.
ignorePlurals
settings search
Consider singular and plurals forms a match without typo.
disableTypoToleranceOnAttributes
settings search
List of attributes on which you want to disable typo tolerance
disableTypoToleranceOnWords
settings
List of words on which typo tolerance will be disabled.
separatorsToIndex
settings
Separators (punctuation characters) to index.
aroundLatLng
search
Search for entries around a given location.
aroundLatLngViaIP
search
Search for entries around a given location automatically computed from the requester's IP address.
aroundRadius
search
Maximum radius for geo search (in meters).
aroundPrecision
search
Precision of geo search (in meters).
minimumAroundRadius
search
Minimum radius (in meters) used for a geo search when <%= parameter_link('aroundRadius') -%> is not set.
insideBoundingBox
search
Search inside a rectangular area (in geo coordinates).
insidePolygon
search
Search inside a polygon (in geo coordinates).

Query Strategy

queryType
search settings
Controls if and how query words are interpreted as prefixes.
removeWordsIfNoResults
settings search
Selects a strategy to remove words from the query when it doesn't match any hits.
advancedSyntax
settings search
Enables the advanced query syntax.
optionalWords
settings search
List of words that should be considered as optional when found in the query.
removeStopWords
settings search
Remove stop words from the query **before** executing it.
disablePrefixOnAttributes
settings
List of attributes on which you want to disable prefix matching
disableExactOnAttributes
settings search
List of attributes on which you want to disable computation of the `exact` ranking criterion
exactOnSingleWordQuery
settings search
Controls how the `exact` ranking criterion is computed when the query contains only one word.
alternativesAsExact
setting search
List of alternatives that should be considered an exact match by the `exact` ranking criterion.

Query Rules

enableRules
search settings
Whether rules should be globally enabled.
ruleContexts
search
Enables contextual rules.

Performance

numericAttributesForFiltering
settings
List of numeric attributes that can be used as numerical filters.
allowCompressionOfIntegerArray
settings
Enables compression of large integer arrays.

Advanced

attributeForDistinct
settings
Name of the de-duplication attribute for the <%= parameter_link('distinct') -%> feature.
minProximity
settings search
Precision of the `proximity` ranking criterion.
responseFields
settings search
Choose which fields the response will contain. Applies to search and browse queries.
maxFacetHits
settings search
Maximum number of facet hits to return during a search for facet values.
percentileComputation
search
Whether to include the query in processing time percentile computation.
camelCaseAttributes
settings
List of attributes on which to do a decomposition of camel case words.
distinct
settings search
Controls de-duplication of results.
getRankingInfo
search
Enables detailed ranking information.
numericFilters
search
Filter hits based on values of numeric attributes.
tagFilters
search
Filter hits by tags.
analytics
search
Whether the current query will be taken into account in the Analytics.
analyticsTags
search
List of tags to apply to the query in the Analytics.
synonyms
search
Whether to take into account synonyms defined for the targeted index.
replaceSynonymsInHighlight
settings search
Whether to replace words matched via synonym expansion by the matched synonym in highlight and snippet results.