Android

Settings

Get settings - getSettingsAsync

You can retrieve settings:

index.getSettingsAsync(new CompletionHandler() {
    @Override
    public void requestCompleted(JSONObject content, AlgoliaException error) {
        // [...]
    }
});

Set settings - setSettingsAsync

index.setSettingsAsync(new JSONObject().append("customRanking", "desc(followers)"), null);

You can find the list of parameters you can set in the Settings Parameters section

Warning

Performance wise, it’s better to do a setSettingsAsync before pushing the data

Replica settings

You can forward all settings updates to the replicas of an index by using the forwardToReplicas option:

JSONObject settings = new JSONObject("{\"attributesToRetrieve\": [\"name\", \"birthdate\"]}");
JSONObject setSettingsResult = index.setSettings(settings, true);
index.waitTask(setSettingsResult.getString("taskID"));

Index settings parameters

Here is the list of parameters you can use with the set settings method (settings scope).

Parameters that can be overridden at search time also have the search scope.

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.

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

maxValuesPerFacet
settings search

Maximum number of facet values returned for each facet.

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

hitsPerPage
settings search

Maximum number of hits per page.

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.

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.

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 distinct feature.

distinct
settings search

Controls de-duplication of results.

replaceSynonymsInHighlight
settings search

Whether to replace words matched via synonym expansion by the matched synonym in highlight and snippet results.

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.

Did you find this page helpful?

We're always looking for advice to help improve our documentation! Please let us know what's working (or what's not!) - we're constantly iterating thanks to the feedback we receive.

Send us your suggestions!