Skip to content

Commit 6c92cd9

Browse files
docs(README): automatic update
Update README Swift [This list might not be relevant] fix wrong anchors Add `responseFields` search parameter (#138) refactor: Renaming attributes (#132) * refactor: Renaming attributes Specifically, this commit replaces: - attributesToIndex with searchableAttributes - numericAttributesToIndex with numericAttributesForFiltering * refactor: Renaming `forwardToSlaves` into `forwardToReplicas` * Display legacy names in parameter descriptions Settings: Fix `indexing` scope instead of `settings` (#139) Clarify `queryAfterRemoval` search response field Add documentation for restrictSources (#134) * Add documentation for restrictSources adding typescript setup to menu (#131) [ci skip]
1 parent 08d8f8f commit 6c92cd9

File tree

1 file changed

+49
-25
lines changed

1 file changed

+49
-25
lines changed

README.md

Lines changed: 49 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,7 @@ You can also configure the list of attributes you want to index by order of impo
208208

209209
```swift
210210
let customRanking = ["lastname", "firstname", "company", "email", "city", "address"]
211-
let settings = ["attributesToIndex": customRanking]
211+
let settings = ["searchableAttributes": customRanking]
212212
index.setSettings(settings, completionHandler: { (content, error) -> Void in
213213
if error != nil {
214214
print("Error when applying settings: \(error!)")
@@ -367,7 +367,7 @@ The server response will look like:
367367

368368
- `query` (string): An echo of the query text. See the [`query`](#query) search parameter.
369369

370-
- `queryAfterRemoval` (string, optional): *Note: Only returned when [`removeWordsIfNoResults`](#removewordsifnoresults) is set.* A markup text indicating which parts of the original query have been removed in order to retrieve a non-empty result set. The removed parts are surrounded by `<em>` tags.
370+
- `queryAfterRemoval` (string, optional): *Note: Only returned when [`removeWordsIfNoResults`](#removewordsifnoresults) is set to `lastWords` or `firstWords`.* A markup text indicating which parts of the original query have been removed in order to retrieve a non-empty result set. The removed parts are surrounded by `<em>` tags.
371371

372372
- `params` (string, URL-encoded): An echo of all search parameters.
373373

@@ -491,6 +491,7 @@ Parameters that can also be used in a setSettings also have the `indexing` [scop
491491
- [synonyms](#synonyms) `search`
492492
- [replaceSynonymsInHighlight](#replacesynonymsinhighlight) `search`, `settings`
493493
- [minProximity](#minproximity) `search`, `settings`
494+
- [responseFields](#responsefields) `search`, `settings`
494495

495496
<!--/PARAMETERS_LINK-->
496497

@@ -658,7 +659,7 @@ index.saveObjects([obj1, obj2], completionHandler: { (content, error) -> Void in
658659
})
659660
```
660661
661-
To update a single object, you can use the `[Update object](#update-object---saveobject) method:
662+
To update a single object, you can use the `saveObject` method:
662663
663664
```swift
664665
let newObject = [
@@ -856,9 +857,9 @@ index.setSettings(settings)
856857
857858
Performance wise, it's better to do a `setSettings` before pushing the data
858859
859-
#### Slave settings
860+
#### Replica settings
860861
861-
You can forward all settings updates to the slaves of an index by using the `forwardToSlaves` option:
862+
You can forward all settings updates to the replicas of an index by using the `forwardToReplicas` option:
862863
863864
```swift
864865
let settings = ["attributesToRetrieve": "name", "birthdate"]
@@ -873,14 +874,14 @@ index.setSettings(settings, forwardToReplicas: true, completionHandler: { (conte
873874
874875
<!--PARAMETERS_LINK-->
875876
876-
Here is the list of parameters you can use with the set settings method (`indexing` [scope](#scope))
877+
Here is the list of parameters you can use with the set settings method (`settings` [scope](#scope)).
877878
878879
879-
Parameters that can be overridden at search time also have the `search` [scope](#scope)
880+
Parameters that can be overridden at search time also have the `search` [scope](#scope).
880881
881882
**Attributes**
882883
883-
- [attributesToIndex](#attributestoindex) `settings`
884+
- [searchableAttributes](#searchableattributes) `settings`
884885
- [attributesForFaceting](#attributesforfaceting) `settings`
885886
- [attributesToRetrieve](#attributestoretrieve) `settings`, `search`
886887
- [unretrievableAttributes](#unretrievableattributes) `settings`
@@ -889,7 +890,7 @@ Parameters that can be overridden at search time also have the `search` [scope](
889890
890891
- [ranking](#ranking) `settings`
891892
- [customRanking](#customranking) `settings`
892-
- [slaves](#slaves) `settings`
893+
- [replicas](#replicas) `settings`
893894
894895
**Filtering / Faceting**
895896
@@ -933,7 +934,7 @@ Parameters that can be overridden at search time also have the `search` [scope](
933934
934935
- [attributeForDistinct](#attributefordistinct) `settings`
935936
- [distinct](#distinct) `settings`, `search`
936-
- [numericAttributesToIndex](#numericattributestoindex) `settings`
937+
- [numericAttributesForFiltering](#numericattributesforfiltering) `settings`
937938
- [allowCompressionOfIntegerArray](#allowcompressionofintegerarray) `settings`
938939
- [altCorrections](#altcorrections) `settings`
939940
- [placeholders](#placeholders) `settings`
@@ -965,7 +966,7 @@ They are three scopes:
965966
966967
**Attributes**
967968
968-
- [attributesToIndex](#attributestoindex) `settings`
969+
- [searchableAttributes](#searchableattributes) `settings`
969970
- [attributesForFaceting](#attributesforfaceting) `settings`
970971
- [unretrievableAttributes](#unretrievableattributes) `settings`
971972
- [attributesToRetrieve](#attributestoretrieve) `settings`, `search`
@@ -975,7 +976,7 @@ They are three scopes:
975976
976977
- [ranking](#ranking) `settings`
977978
- [customRanking](#customranking) `settings`
978-
- [slaves](#slaves) `settings`
979+
- [replicas](#replicas) `settings`
979980
980981
**Filtering / Faceting**
981982
@@ -1036,7 +1037,7 @@ They are three scopes:
10361037
- [attributeForDistinct](#attributefordistinct) `settings`
10371038
- [distinct](#distinct) `settings`, `search`
10381039
- [getRankingInfo](#getrankinginfo) `search`
1039-
- [numericAttributesToIndex](#numericattributestoindex) `settings`
1040+
- [numericAttributesForFiltering](#numericattributesforfiltering) `settings`
10401041
- [allowCompressionOfIntegerArray](#allowcompressionofintegerarray) `settings`
10411042
- [numericFilters (deprecated)](#numericfilters-deprecated) `search`
10421043
- [tagFilters (deprecated)](#tagfilters-deprecated) `search`
@@ -1048,6 +1049,7 @@ They are three scopes:
10481049
- [placeholders](#placeholders) `settings`
10491050
- [altCorrections](#altcorrections) `settings`
10501051
- [minProximity](#minproximity) `search`, `settings`
1052+
- [responseFields](#responsefields) `search`, `settings`
10511053
10521054
### Search
10531055
@@ -1062,11 +1064,12 @@ The instant search query string, used to set the string you want to search in yo
10621064
10631065
### Attributes
10641066
1065-
#### attributesToIndex
1067+
#### searchableAttributes
10661068
10671069
- scope: `settings`
10681070
- type: `array of strings`
10691071
- default: `*`
1072+
- formerly known as: `attributesToIndex`
10701073
10711074
10721075
The list of attributes you want index (i.e. to make searchable).
@@ -1078,7 +1081,7 @@ This parameter has two important uses:
10781081
10791082
1. **Limit the attributes to index.** For example, if you store the URL of a picture, you want to store it and be able to retrieve it, but you probably don't want to search in the URL.
10801083
1081-
2. **Control part of the ranking.** The contents of the `attributesToIndex` parameter impacts ranking in two complementary ways:
1084+
2. **Control part of the ranking.** The contents of the `searchableAttributes` parameter impacts ranking in two complementary ways:
10821085
10831086
First, the order in which attributes are listed defines their ranking priority: matches in attributes at the beginning of the list will be considered more important than matches in attributes further down the list. To assign the same priority to several attributes, pass them within the same string, separated by commas. For example, by specifying `["title,"alternative_title", "text"]`, `title` and `alternative_title` will have the same priority, but a higher priority than `text`.
10841087

@@ -1133,13 +1136,13 @@ You can also use `*` to retrieve all values when an **attributesToRetrieve** set
11331136

11341137
- scope: `search`
11351138
- type: `array of strings`
1136-
- default: `attributesToIndex`
1139+
- default: `searchableAttributes`
11371140

11381141

1139-
List of attributes you want to use for textual search (must be a subset of the `attributesToIndex` index setting).
1142+
List of attributes you want to use for textual search (must be a subset of the `searchableAttributes` index setting).
11401143
Attributes are separated with a comma such as `"name,address"`.
11411144
You can also use JSON string array encoding such as `encodeURIComponent("[\"name\",\"address\"]")`.
1142-
By default, all attributes specified in the `attributesToIndex` settings are used to search.
1145+
By default, all attributes specified in the `searchableAttributes` settings are used to search.
11431146

11441147

11451148
### Ranking
@@ -1159,7 +1162,7 @@ We have nine available criterion:
11591162
* `geo`: Sort according to decreasing distance when performing a geo location based search.
11601163
* `words`: Sort according to the number of query words matched by decreasing order. This parameter is useful when you use the `optionalWords` query parameter to have results with the most matched words first.
11611164
* `proximity`: Sort according to the proximity of the query words in hits.
1162-
* `attribute`: Sort according to the order of attributes defined by attributesToIndex.
1165+
* `attribute`: Sort according to the order of attributes defined by searchableAttributes.
11631166
* `exact`:
11641167
* If the user query contains one word: sort objects having an attribute that is exactly the query word before others. For example, if you search for the TV show "V", you want to find it with the "V" query and avoid getting all popular TV shows starting by the letter V before it.
11651168
* If the user query contains multiple words: sort according to the number of words that matched exactly (not as a prefix).
@@ -1187,11 +1190,12 @@ For example, `"customRanking" => ["desc(population)", "asc(name)"]`.
11871190
To get a full description of how the Custom Ranking works,
11881191
you can have a look at our [Ranking guide](https://www.algolia.com/doc/guides/relevance/ranking).
11891192

1190-
#### slaves
1193+
#### replicas
11911194

11921195
- scope: `settings`
11931196
- type: `array of strings`
11941197
- default: `[]`
1198+
- formerly known as: `slaves`
11951199

11961200

11971201
The list of indices on which you want to replicate all write operations.
@@ -1202,7 +1206,7 @@ If you want to use different ranking configurations depending of the use case,
12021206
you need to create one index per ranking configuration.
12031207

12041208
This option enables you to perform write operations only on this index and automatically
1205-
update slave indices with the same operations.
1209+
update replica indices with the same operations.
12061210

12071211
### Filtering / Faceting
12081212

@@ -1474,7 +1478,7 @@ If set to true, plural won't be considered as a typo. For example, car and cars,
14741478

14751479

14761480
List of attributes on which you want to disable typo tolerance
1477-
(must be a subset of the `attributesToIndex` index setting).
1481+
(must be a subset of the `searchableAttributes` index setting).
14781482

14791483
Attributes are separated with a comma such as `"name,address"`.
14801484
You can also use JSON string array encoding such as `encodeURIComponent("[\"name\",\"address\"]")`.
@@ -1732,7 +1736,7 @@ For most use cases, it is better to not use this feature as people search by key
17321736
17331737
17341738
List of attributes on which you want to disable prefix matching
1735-
(must be a subset of the `attributesToIndex` index setting).
1739+
(must be a subset of the `searchableAttributes` index setting).
17361740
17371741
This setting is useful on attributes that contain string that should not be matched as a prefix
17381742
(for example a product SKU).
@@ -1746,7 +1750,7 @@ This setting is useful on attributes that contain string that should not be matc
17461750
17471751
17481752
List of attributes on which you want to disable the computation of `exact` criteria
1749-
(must be a subset of the `attributesToIndex` index setting).
1753+
(must be a subset of the `searchableAttributes` index setting).
17501754
17511755
#### exactOnSingleWordQuery
17521756
@@ -1826,11 +1830,12 @@ you can have a look at our [guide on distinct](https://www.algolia.com/doc/searc
18261830
If set to true,
18271831
the result hits will contain ranking information in the **_rankingInfo** attribute.
18281832
1829-
#### numericAttributesToIndex
1833+
#### numericAttributesForFiltering
18301834
18311835
- scope: `settings`
18321836
- type: `array of strings`
18331837
- default: ``
1838+
- formerly known as: `numericAttributesToIndex`
18341839
18351840
18361841
All numerical attributes are automatically indexed as numerical filters
@@ -2023,6 +2028,25 @@ Considering the query *“javascript framework”*, if you set `minProximity=2`,
20232028
20242029
**Note:** the maximum `minProximity` that can be set is 7. Any higher value will disable the `proximity` criterion from the ranking formula.
20252030
2031+
#### responseFields
2032+
2033+
- scope: `search`, `settings`
2034+
- type: `array of strings`
2035+
- default: `*`
2036+
2037+
2038+
Choose which fields the response will contain. Applies to search and browse queries.
2039+
2040+
By default, all fields are returned. If this parameter is specified, only the fields explicitly listed will be returned, unless `*` is used, in which case all fields are returned. Specifying an empty list or unknown field names is an error.
2041+
2042+
This parameter is mainly intended to limit the response size. For example, for complex queries, echoing of request parameters in the response's `params` field can be undesirable.
2043+
2044+
Some fields cannot be filtered out:
2045+
2046+
- warning `message`
2047+
- `cursor` in browse queries
2048+
- fields triggered explicitly via [getRankingInfo](#getrankinginfo)
2049+
20262050
20272051
## Manage Indices
20282052

0 commit comments

Comments
 (0)