Settings
List of methods
Get settings |
Get the settings of an index. |
Set settings |
Create or change an index’s settings. |
Copy settings |
Copy the settings of an index to another index on the same app. |
It’s recommended to use the Kotlin API client, which is better suited for Android development.
The scope of settings (and parameters)
Settings are set on the index and/or during a particular query. In both cases, they are sent to Algolia using parameters.
- For the index, we use the set settings method.
- For the search, we use the search method.
Importantly, each parameter has kinds of scope (See API Parameters). There are 3 scopes:
settings
Parameters with a setting scope can only be used in the set settings method. Meaning that it is not available as a search parameter.
Index settings are built directly into your index at indexing time, and they impact every search.
search
Individual queries can be parameterized. To do this, you pass search parameters to the search method. These parameters affect only those queries that use them; they do not set any index defaults.
Both settings
and search
When applying both, you create a default + override logic: with the settings
, you set an index default using the set settings method. These settings can then be overriden by your search method. Only some settings can be overidden. You will need to consult each settings to see its scope.
Note that, if you do not apply an index setting or search parameter, the system will apply an engine level default.
Example
Just to make all of this more concrete, here is an example of an index setting. In this example, all queries performed on this index will use a queryType
of prefixLast
:
1
2
3
4
5
index.setSettings({
queryType: 'prefixLast'
}).then(() => {
// done
});
So every query will apply a prefixLast logic. However, this can be overridden.
Here is a query that overrides that index setting with prefixAll
:
1
2
3
4
5
index.search('query', {
queryType: 'prefixAll'
}).then(() => {
// done
});
Categories
As you start fine-tuning Algolia, you will want to use more of its settings. Mastering these settings will enable you to get the best out of Algolia.
To help you navigate our list of settings, we’ve created the following setting categories: