Skip to content

Commit 641621b

Browse files
author
maxiloc
authored
Merge pull request #122 from algoliareadmebot/master
Update README
2 parents 8a3d2fb + a9bdc64 commit 641621b

File tree

1 file changed

+128
-46
lines changed

1 file changed

+128
-46
lines changed

README.md

Lines changed: 128 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -357,11 +357,11 @@ The server response will look like:
357357

358358
- `nbHits` (integer): Number of hits that the search query matched.
359359

360-
- `page` (integer): Index of the current page (zero-based). See the [`page`](#page) search parameter.
360+
- `page` (integer): Index of the current page (zero-based). See the [`page`](#page) search parameter. *Note: Not returned if you use `offset`/`length` for pagination.*
361361

362-
- `hitsPerPage` (integer): Maximum number of hits returned per page. See the [`hitsPerPage`](#hitsperpage) search parameter.
362+
- `hitsPerPage` (integer): Maximum number of hits returned per page. See the [`hitsPerPage`](#hitsperpage) search parameter. *Note: Not returned if you use `offset`/`length` for pagination.*
363363

364-
- `nbPages` (integer): Number of pages corresponding to the number of hits. Basically, `ceil(nbHits / hitsPerPage)`.
364+
- `nbPages` (integer): Number of pages corresponding to the number of hits. Basically, `ceil(nbHits / hitsPerPage)`. *Note: Not returned if you use `offset`/`length` for pagination.*
365365

366366
- `processingTimeMS` (integer): Time that the server took to process the request, in milliseconds. *Note: This does not include network time.*
367367

@@ -381,7 +381,7 @@ When [`getRankingInfo`](#getrankinginfo) is set to `true`, the following additio
381381

382382
- `serverUsed` (string): Actual host name of the server that processed the request. (Our DNS supports automatic failover and load balancing, so this may differ from the host name used in the request.)
383383

384-
- `parsedQuery` (string): The query string that will be searched, after normalization.
384+
- `parsedQuery` (string): The query string that will be searched, after normalization. Normalization includes removing stop words (if [removeStopWords](#removestopwords) is enabled), and transforming portions of the query string into phrase queries (see [advancedSyntax](#advancedsyntax)).
385385

386386
- `timeoutCounts` (boolean): Whether a timeout was hit when computing the facet counts. When `true`, the counts will be interpolated (i.e. approximate). See also `exhaustiveFacetsCount`.
387387

@@ -425,6 +425,7 @@ Parameters that can also be used in a setSettings also have the `indexing` [scop
425425
**Attributes**
426426

427427
- [attributesToRetrieve](#attributestoretrieve) `settings`, `search`
428+
- [restrictSearchableAttributes](#restrictsearchableattributes) `search`
428429

429430
**Filtering / Faceting**
430431

@@ -439,11 +440,14 @@ Parameters that can also be used in a setSettings also have the `indexing` [scop
439440
- [highlightPreTag](#highlightpretag) `settings`, `search`
440441
- [highlightPostTag](#highlightposttag) `settings`, `search`
441442
- [snippetEllipsisText](#snippetellipsistext) `settings`, `search`
443+
- [restrictHighlightAndSnippetArrays](#restricthighlightandsnippetarrays) `settings`, `search`
442444

443445
**Pagination**
444446

445447
- [page](#page) `search`
446448
- [hitsPerPage](#hitsperpage) `settings`, `search`
449+
- [offset](#offset) `search`
450+
- [length](#length) `search`
447451

448452
**Typos**
449453

@@ -471,6 +475,7 @@ Parameters that can also be used in a setSettings also have the `indexing` [scop
471475
- [advancedSyntax](#advancedsyntax) `settings`, `search`
472476
- [optionalWords](#optionalwords) `settings`, `search`
473477
- [removeStopWords](#removestopwords) `settings`, `search`
478+
- [disableExactOnAttributes](#disableexactonattributes) `settings`, `search`
474479
- [exactOnSingleWordQuery](#exactonsinglewordquery) `settings`, `search`
475480
- [alternativesAsExact](#alternativesasexact) `settings`, `search`
476481

@@ -482,9 +487,52 @@ Parameters that can also be used in a setSettings also have the `indexing` [scop
482487
- [tagFilters (deprecated)](#tagfilters-deprecated) `search`
483488
- [facetFilters (deprecated)](#facetfilters-deprecated) `search`
484489
- [analytics](#analytics) `search`
490+
- [analyticsTags](#analyticstags) `search`
491+
- [synonyms](#synonyms) `search`
492+
- [replaceSynonymsInHighlight](#replacesynonymsinhighlight) `search`, `settings`
493+
- [minProximity](#minproximity) `search`, `settings`
485494

486495
<!--/PARAMETERS_LINK-->
487496

497+
### Multiple queries - `multipleQueries`
498+
499+
You can send multiple queries with a single API call using a batch of queries:
500+
501+
```swift
502+
// Perform 3 queries in a single API call:
503+
// - 1st query target index `categories`
504+
// - 2nd and 3rd queries target index `products`
505+
let queries = [
506+
IndexQuery(indexName: "categories", query: Query(query: "electronics")),
507+
IndexQuery(indexName: "products", query: Query(query: "iPhone")),
508+
IndexQuery(indexName: "products", query: Query(query: "Galaxy"))
509+
]
510+
client.multipleQueries(queries, completionHandler: { (content, error) -> Void in
511+
if error == nil {
512+
print("Result: \(content!)")
513+
}
514+
})
515+
```
516+
517+
You can specify a `strategy` parameter to optimize your multiple queries:
518+
519+
- `none`: Execute the sequence of queries until the end.
520+
- `stopIfEnoughMatches`: Execute the sequence of queries until the number of hits is reached by the sum of hits.
521+
522+
#### Response
523+
524+
The resulting JSON contains the following fields:
525+
526+
- `results` (array): The results for each request, in the order they were submitted. The contents are the same as in [Search in an index](#search-in-an-index---search).
527+
528+
Each result also includes the following additional fields:
529+
530+
- `index` (string): The name of the targeted index.
531+
532+
- `processed` (boolean, optional): *Note: Only returned when `strategy` is `stopIfEnoughmatches`.* Whether the query was processed.
533+
534+
535+
488536
### Find by IDs - `getObjects`
489537

490538
You can easily retrieve an object using its `objectID` and optionally specify a comma separated list of attributes you want:
@@ -871,11 +919,11 @@ They are three scopes:
871919

872920
**Attributes**
873921

874-
- [attributesForFaceting](#attributesforfaceting) `settings`
875922
- [attributesToIndex](#attributestoindex) `settings`
876-
- [attributesToRetrieve](#attributestoretrieve) `settings`, `search`
923+
- [attributesForFaceting](#attributesforfaceting) `settings`
877924
- [unretrievableAttributes](#unretrievableattributes) `settings`
878-
925+
- [attributesToRetrieve](#attributestoretrieve) `settings`, `search`
926+
- [restrictSearchableAttributes](#restrictsearchableattributes) `search`
879927

880928
**Ranking**
881929

@@ -902,6 +950,8 @@ They are three scopes:
902950

903951
- [page](#page) `search`
904952
- [hitsPerPage](#hitsperpage) `settings`, `search`
953+
- [offset](#offset) `search`
954+
- [length](#length) `search`
905955

906956
**Typos**
907957

@@ -946,8 +996,12 @@ They are three scopes:
946996
- [tagFilters (deprecated)](#tagfilters-deprecated) `search`
947997
- [facetFilters (deprecated)](#facetfilters-deprecated) `search`
948998
- [analytics](#analytics) `search`
949-
- [altCorrections](#altcorrections) `settings`
999+
- [analyticsTags](#analyticstags) `search`
1000+
- [synonyms](#synonyms) `search`
1001+
- [replaceSynonymsInHighlight](#replacesynonymsinhighlight) `search`, `settings`
9501002
- [placeholders](#placeholders) `settings`
1003+
- [altCorrections](#altcorrections) `settings`
1004+
- [minProximity](#minproximity) `search`, `settings`
9511005

9521006
### Search
9531007

@@ -1188,6 +1242,10 @@ Limit the number of facet values returned for each facet.
11881242

11891243
For example, `maxValuesPerFacet=10` will retrieve a maximum of 10 values per facet.
11901244

1245+
**Warnings**
1246+
1247+
- The engine has a hard limit on the `maxValuesPerFacet` of `1000`. Any value above that will be interpreted by the engine as being `1000`.
1248+
11911249
### Highlighting / Snippeting
11921250

11931251
#### attributesToHighlight
@@ -1287,6 +1345,28 @@ Pagination parameter used to select the page to retrieve.
12871345

12881346
Pagination parameter used to select the number of hits per page.
12891347

1348+
#### offset
1349+
1350+
- scope: `search`
1351+
- type: `integer`
1352+
- default: `null`
1353+
1354+
1355+
Offset of the first hit to return (zero-based).
1356+
1357+
**Warning:** In most cases, `page`/`hitsPerPage` is the recommended method for pagination; `offset`/`length` is reserved for advanced use.
1358+
1359+
#### length
1360+
1361+
- scope: `search`
1362+
- type: `integer`
1363+
- default: `null`
1364+
1365+
1366+
Number of hits to return.
1367+
1368+
**Warning:** In most cases, `page`/`hitsPerPage` is the recommended method for pagination; `offset`/`length` is reserved for advanced use.
1369+
12901370
### Typos
12911371

12921372
#### minWordSizefor1Typo
@@ -1810,6 +1890,33 @@ For example, `[["category:Book","category:Movie"],"author:John%20Doe"]`.
18101890
18111891
If set to false, this query will not be taken into account in the analytics feature.
18121892
1893+
#### analyticsTags
1894+
1895+
- scope: `search`
1896+
- type: `array of strings`
1897+
- default: `null`
1898+
1899+
1900+
If set, tag your query with the specified identifiers. Tags can then be used in the Analytics to analyze a subset of searches only.
1901+
1902+
#### synonyms
1903+
1904+
- scope: `search`
1905+
- type: `boolean`
1906+
- default: `true`
1907+
1908+
1909+
If set to `false`, the search will not use the synonyms defined for the targeted index.
1910+
1911+
#### replaceSynonymsInHighlight
1912+
1913+
- scope: `search`, `settings`
1914+
- type: `boolean`
1915+
- default: `true`
1916+
1917+
1918+
If set to `false`, words matched via synonym expansion will not be replaced by the matched synonym in the highlighted result.
1919+
18131920
#### placeholders
18141921
18151922
- scope: `settings`
@@ -1857,6 +1964,19 @@ For example:
18571964
]
18581965
```
18591966
1967+
#### minProximity
1968+
1969+
- scope: `search`, `settings`
1970+
- type: `integer`
1971+
- default: `1`
1972+
1973+
1974+
Configure the precision of the `proximity` ranking criterion. By default, the minimum (and best) proximity value distance between 2 matching words is 1. Setting it to 2 (or 3) would allow 1 (or 2) words to be found between the matching words without degrading the proximity ranking value.
1975+
1976+
Considering the query *“javascript framework”*, if you set `minProximity=2`, the records *“JavaScript framework”* and *“JavaScript charting framework”* will get the same proximity score, even if the second contains a word between the two matching words.
1977+
1978+
**Note:** the maximum `minProximity` that can be set is 7. Any higher value will disable the `proximity` criterion from the ranking formula.
1979+
18601980
18611981
## Manage Indices
18621982
@@ -2049,44 +2169,6 @@ iterator.start()
20492169
```
20502170
20512171
2052-
### Multiple queries - `multipleQueries`
2053-
2054-
You can send multiple queries with a single API call using a batch of queries:
2055-
2056-
```swift
2057-
// Perform 3 queries in a single API call:
2058-
// - 1st query target index `categories`
2059-
// - 2nd and 3rd queries target index `products`
2060-
let queries = [
2061-
IndexQuery(indexName: "categories", query: Query(query: "electronics")),
2062-
IndexQuery(indexName: "products", query: Query(query: "iPhone")),
2063-
IndexQuery(indexName: "products", query: Query(query: "Galaxy"))
2064-
]
2065-
client.multipleQueries(queries, completionHandler: { (content, error) -> Void in
2066-
if error == nil {
2067-
print("Result: \(content!)")
2068-
}
2069-
})
2070-
```
2071-
2072-
You can specify a `strategy` parameter to optimize your multiple queries:
2073-
2074-
- `none`: Execute the sequence of queries until the end.
2075-
- `stopIfEnoughMatches`: Execute the sequence of queries until the number of hits is reached by the sum of hits.
2076-
2077-
#### Response
2078-
2079-
The resulting JSON contains the following fields:
2080-
2081-
- `results` (array): The results for each request, in the order they were submitted. The contents are the same as in [Search in an index](#search-in-an-index---search).
2082-
2083-
Each result also includes the following additional fields:
2084-
2085-
- `index` (string): The name of the targeted index.
2086-
2087-
- `processed` (boolean, optional): *Note: Only returned when `strategy` is `stopIfEnoughmatches`.* Whether the query was processed.
2088-
2089-
20902172
20912173
### REST API
20922174

0 commit comments

Comments
 (0)