Skip to content

Commit fc3a9a8

Browse files
author
Clément Le Provost
authored
Merge pull request #71 from algoliareadmebot/master [ci skip]
Update README. Supersedes #72.
2 parents 28a5cab + 104eedb commit fc3a9a8

File tree

1 file changed

+154
-8
lines changed

1 file changed

+154
-8
lines changed

README.md

Lines changed: 154 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ To setup your project, follow these steps:
8282

8383

8484
1. Add a dependency on AlgoliaSearch-Client-Swift:
85-
- Cocoapods: add `pod 'AlgoliaSearch-Client-Swift', '~> 3.0'` to your `Podfile`.
85+
- CocoaPods: add `pod 'AlgoliaSearch-Client-Swift', '~> 3.0'` to your `Podfile`.
8686
- Carthage: add `github "algolia/algoliasearch-client-swift"` to your `Cartfile`.
8787
2. Add `import AlgoliaSearch` to your source files.
8888
3. Initialize the client with your application ID and API key (you can find them on [your Algolia Dashboard](https://www.algolia.com/api-keys)):
@@ -213,7 +213,7 @@ Check our [online guides](https://www.algolia.com/doc):
213213
Add a new object to the Index
214214
==================
215215

216-
Each entry in an index has a unique identifier called `objectID`. There are two ways to add en entry to the index:
216+
Each entry in an index has a unique identifier called `objectID`. There are two ways to add an entry to the index:
217217

218218
1. Using automatic `objectID` assignment. You will be able to access it in the answer.
219219
2. Supplying your own `objectID`.
@@ -613,7 +613,65 @@ You can use the following optional arguments:
613613
</div>
614614
</td>
615615
<td class='client-readme-param-content'>
616-
<p>Remove the stop words from query before executing it. Defaults to false. Contains a list of stop words from 41 languages (Arabic, Armenian, Basque, Bengali, Brazilian, Bulgarian, Catalan, Chinese, Czech, Danish, Dutch, English, Finnish, French, Galician, German, Greek, Hindi, Hungarian, Indonesian, Irish, Italian, Japanese, Korean, Kurdish, Latvian, Lithuanian, Marathi, Norwegian, Persian, Polish, Portugese, Romanian, Russian, Slovak, Spanish, Swedish, Thai, Turkish, Ukranian, Urdu). In most use-cases, we don&#39;t recommend enabling this option.</p>
616+
<p>Remove stop words from the query <strong>before</strong> executing it. Defaults to <code>false</code>. Use a boolean to enable/disable all 41 supported languages and a comma separated list of iso codes of the languages you want to use consider to enable the stopwords removal on a subset of them (select the one you have in your records). In most use-cases, you shouldn&#39;t need to enable this option.</p>
617+
618+
<p>List of 41 supported languages with their associated iso code: Arabic=ar, Armenian=hy, Basque=eu, Bengali=bn, Brazilian=pt-br, Bulgarian=bg, Catalan=ca, Chinese=zh, Czech=cs, Danish=da, Dutch=nl, English=en, Finnish=fi, French=fr, Galician=gl, German=de, Greek=el, Hindi=hi, Hungarian=hu, Indonesian=id, Irish=ga, Italian=it, Japanese=ja, Korean=ko, Kurdish=ku, Latvian=lv, Lithuanian=lt, Marathi=mr, Norwegian=no, Persian (Farsi)=fa, Polish=pl, Portugese=pt, Romanian=ro, Russian=ru, Slovak=sk, Spanish=es, Swedish=sv, Thai=th, Turkish=tr, Ukranian=uk, Urdu=ur</p>
619+
620+
<p>Stop words removal is applied on query words that are not interpreted as a prefix. The behavior depends of the queryType parameter:</p>
621+
622+
<ul>
623+
<li><p><code>queryType=prefixLast</code> means the last query word is a prefix and it won’t be considered for stop words removal</p></li>
624+
<li><p><code>queryType=prefixNone</code> means no query word are prefix, stop words removal will be applied on all query words</p></li>
625+
<li><p><code>queryType=prefixAll</code> means all query terms are prefix, stop words won’t be removed</p></li>
626+
</ul>
627+
628+
<p>This parameter is useful when you have a query in natural language like “what is a record?”. In this case, before executing the query, we will remove “what”, “is” and “a” in order to just search for “record”. This removal will remove false positive because of stop words, especially when combined with optional words. For most use cases, it is better to not use this feature as people search by keywords on search engines.</p>
629+
630+
</td>
631+
</tr>
632+
633+
634+
635+
<tr>
636+
<td valign='top'>
637+
<div class='client-readme-param-container'>
638+
<div class='client-readme-param-container-inner'>
639+
<div class='client-readme-param-name'><code>exactOnSingleWordQuery</code></div>
640+
<div class="client-readme-param-meta"><div><em>Default: <strong>attribute</strong></em></div></div>
641+
</div>
642+
</div>
643+
</td>
644+
<td class='client-readme-param-content'>
645+
<p>This parameter control how the <code>exact</code> ranking criterion is computed when the query contains one word. There is three different values:</p>
646+
647+
<ul>
648+
<li><p><code>none</code>: no exact on single word query</p></li>
649+
<li><p><code>word</code>: exact set to 1 if the query word is found in the record. The query word needs to have at least 3 chars and not be part of our stop words dictionary</p></li>
650+
<li><p><code>attribute</code> (default): exact set to 1 if there is an attribute containing a string equals to the query</p></li>
651+
</ul>
652+
653+
</td>
654+
</tr>
655+
656+
657+
658+
<tr>
659+
<td valign='top'>
660+
<div class='client-readme-param-container'>
661+
<div class='client-readme-param-container-inner'>
662+
<div class='client-readme-param-name'><code>alternativesAsExact</code></div>
663+
<div class="client-readme-param-meta"><div><em>Default: <strong>["ignorePlurals", "singleWordSynonym"]</strong></em></div></div>
664+
</div>
665+
</div>
666+
</td>
667+
<td class='client-readme-param-content'>
668+
<p>Specify the list of approximation that should be considered as an exact match in the ranking formula:</p>
669+
670+
<ul>
671+
<li><p><code>ignorePlurals</code>: alternative words added by the ignorePlurals feature</p></li>
672+
<li><p><code>singleWordSynonym</code>: single-word synonym (For example &quot;NY&quot; = &quot;NYC&quot;)</p></li>
673+
<li><p><code>multiWordsSynonym</code>: multiple-words synonym (For example &quot;NY&quot; = &quot;New York&quot;)</p></li>
674+
</ul>
617675

618676
</td>
619677
</tr>
@@ -876,7 +934,7 @@ You can use the following optional arguments:
876934
</div>
877935
</td>
878936
<td class='client-readme-param-content'>
879-
<p>A string that contains the list of attributes you want to highlight according to the query. Attributes are separated by commas. You can also use a string array encoding (for example <code>[&quot;name&quot;,&quot;address&quot;]</code>). If an attribute has no match for the query, the raw value is returned. By default, all indexed attributes are highlighted. You can use <code>*</code> if you want to highlight all attributes. A matchLevel is returned for each highlighted attribute and can contain:</p>
937+
<p>A string that contains the list of attributes you want to highlight according to the query. Attributes are separated by commas. You can also use a string array encoding (for example <code>[&quot;name&quot;,&quot;address&quot;]</code>). If an attribute has no match for the query, the raw value is returned. By default, all indexed attributes are highlighted (as long as they are strings). You can use <code>*</code> if you want to highlight all attributes. A matchLevel is returned for each highlighted attribute and can contain:</p>
880938

881939
<ul>
882940
<li><strong>full</strong>: If all the query terms were found in the attribute.</li>
@@ -1023,7 +1081,7 @@ You can also use a string array encoding (for example `numericFilters: ["price>1
10231081
</div>
10241082
</td>
10251083
<td class='client-readme-param-content'>
1026-
<p>Filter the query by a set of tags. You can AND tags by separating them with commas. To OR tags, you must add parentheses. For example, <code>tags=tag1,(tag2,tag3)</code> means <em>tag1 AND (tag2 OR tag3)</em>. You can also use a string array encoding. For example, <code>tagFilters: [&quot;tag1&quot;,[&quot;tag2&quot;,&quot;tag3&quot;]]</code> means <em>tag1 AND (tag2 OR tag3)</em>.</p>
1084+
<p>Filter the query by a set of tags. You can AND tags by separating them with commas. To OR tags, you must add parentheses. For example, <code>tagFilters=tag1,(tag2,tag3)</code> means <em>tag1 AND (tag2 OR tag3)</em>. You can also use a string array encoding. For example, <code>tagFilters: [&quot;tag1&quot;,[&quot;tag2&quot;,&quot;tag3&quot;]]</code> means <em>tag1 AND (tag2 OR tag3)</em>. Negations are supported via the <code>-</code> operator, prefixing the value. For example: <code>tagFilters=tag1,-tag2</code>.</p>
10271085

10281086
<p>At indexing, tags should be added in the <strong>_tags</strong> attribute of objects. For example <code>{&quot;_tags&quot;:[&quot;tag1&quot;,&quot;tag2&quot;]}</code>.</p>
10291087

@@ -1252,12 +1310,12 @@ You can delete an object using its `objectID`:
12521310
index.deleteObject("myID")
12531311
```
12541312

1255-
12561313
Delete by query
12571314
==================
12581315

12591316
You can delete all objects matching a single query with the following code. Internally, the API client performs the query, deletes all matching hits, and waits until the deletions have been applied.
12601317

1318+
12611319
```swift
12621320
let query: Query = /* [...] */
12631321
index.deleteByQuery(query)
@@ -1575,6 +1633,38 @@ To get a full description of how the Ranking works, you can have a look at our <
15751633
</tr>
15761634

15771635

1636+
<tr>
1637+
<td valign='top'>
1638+
<div class='client-readme-param-container'>
1639+
<div class='client-readme-param-container-inner'>
1640+
<div class='client-readme-param-name'><code>disablePrefixOnAttributes</code></div>
1641+
<div class="client-readme-param-meta"><div><em>Type: <strong>string array</strong></em></div></div>
1642+
</div>
1643+
</div>
1644+
</td>
1645+
<td class='client-readme-param-content'>
1646+
<p>List of attributes on which you want to disable prefix matching (must be a subset of the <code>attributesToIndex</code> index setting). This setting is useful on attributes that contain string that should not be matched as a prefix (for example a product SKU). By default the list is empty.</p>
1647+
1648+
</td>
1649+
</tr>
1650+
1651+
1652+
<tr>
1653+
<td valign='top'>
1654+
<div class='client-readme-param-container'>
1655+
<div class='client-readme-param-container-inner'>
1656+
<div class='client-readme-param-name'><code>disableExactOnAttributes</code></div>
1657+
<div class="client-readme-param-meta"><div><em>Type: <strong>string array</strong></em></div></div>
1658+
</div>
1659+
</div>
1660+
</td>
1661+
<td class='client-readme-param-content'>
1662+
<p>List of attributes on which you want to disable the computation of <code>exact</code> criteria (must be a subset of the <code>attributesToIndex</code> index setting). By default the list is empty.</p>
1663+
1664+
</td>
1665+
</tr>
1666+
1667+
15781668
<tr>
15791669
<td valign='top'>
15801670
<div class='client-readme-param-container'>
@@ -1880,12 +1970,68 @@ To get a full description of how the Ranking works, you can have a look at our <
18801970
<div class='client-readme-param-container'>
18811971
<div class='client-readme-param-container-inner'>
18821972
<div class='client-readme-param-name'><code>removeStopWords</code></div>
1883-
<div class="client-readme-param-meta"><div><em>Type: <strong>boolean</strong></em></div><div><em>Default: <strong>false</strong></em></div></div>
1973+
<div class="client-readme-param-meta"><div><em>Type: <strong>boolean or string array</strong></em></div><div><em>Default: <strong>false</strong></em></div></div>
1974+
</div>
1975+
</div>
1976+
</td>
1977+
<td class='client-readme-param-content'>
1978+
<p>Remove stop words from the query <strong>before</strong> executing it. Defaults to <code>false</code>. Use a boolean to enable/disable all 41 supported languages and an array of string listing the iso codes of the languages you want to use consider to enable the stop words removal on a subset of them (select the one you have in your records).</p>
1979+
1980+
<p>List of 41 supported languages with their associated iso code: Arabic=ar, Armenian=hy, Basque=eu, Bengali=bn, Brazilian=pt-br, Bulgarian=bg, Catalan=ca, Chinese=zh, Czech=cs, Danish=da, Dutch=nl, English=en, Finnish=fi, French=fr, Galician=gl, German=de, Greek=el, Hindi=hi, Hungarian=hu, Indonesian=id, Irish=ga, Italian=it, Japanese=ja, Korean=ko, Kurdish=ku, Latvian=lv, Lithuanian=lt, Marathi=mr, Norwegian=no, Persian (Farsi)=fa, Polish=pl, Portugese=pt, Romanian=ro, Russian=ru, Slovak=sk, Spanish=es, Swedish=sv, Thai=th, Turkish=tr, Ukranian=uk, Urdu=ur.</p>
1981+
1982+
<p>Stop words removal is applied on query words that are not interpreted as a prefix. The behavior depends of the queryType setting:</p>
1983+
1984+
<ul>
1985+
<li><p><code>queryType=prefixLast</code> means the last query word is a prefix and it won’t be considered for stop words removal</p></li>
1986+
<li><p><code>queryType=prefixNone</code> means no query word are prefix, stop words removal will be applied on all query words</p></li>
1987+
<li><p><code>queryType=prefixAll</code> means all query terms are prefix, stop words won’t be removed</p></li>
1988+
</ul>
1989+
1990+
<p>This index setting is useful when you have queries in natural language like “what is a record?”. In this case, before executing the query, we will remove “what”, “is” and “a” in order to just search for “record”. This removal will remove false positive because of stop words. For most use cases, it is better to not use this feature as people search by keywords on search engines.</p>
1991+
1992+
</td>
1993+
</tr>
1994+
1995+
1996+
<tr>
1997+
<td valign='top'>
1998+
<div class='client-readme-param-container'>
1999+
<div class='client-readme-param-container-inner'>
2000+
<div class='client-readme-param-name'><code>exactOnSingleWordQuery</code></div>
2001+
<div class="client-readme-param-meta"><div><em>Type: <strong>string</strong></em></div><div><em>Default: <strong>attribute</strong></em></div></div>
18842002
</div>
18852003
</div>
18862004
</td>
18872005
<td class='client-readme-param-content'>
1888-
<p>Remove stop words from query before executing it. Defaults to false. Contains stop words for 41 languages (Arabic, Armenian, Basque, Bengali, Brazilian, Bulgarian, Catalan, Chinese, Czech, Danish, Dutch, English, Finnish, French, Galician, German, Greek, Hindi, Hungarian, Indonesian, Irish, Italian, Japanese, Korean, Kurdish, Latvian, Lithuanian, Marathi, Norwegian, Persian, Polish, Portugese, Romanian, Russian, Slovak, Spanish, Swedish, Thai, Turkish, Ukranian, Urdu)</p>
2006+
<p>This parameter controls how the <code>exact</code> ranking criterion is computed when the query contains one word. There is three different values:</p>
2007+
2008+
<ul>
2009+
<li><p><code>none</code>: no <code>exact</code> on single word query</p></li>
2010+
<li><p><code>word</code>: <code>exact</code> set to 1 if the query word is found in the record. The query word needs to have at least 3 chars and not be part of our stop words dictionary</p></li>
2011+
<li><p><code>attribute</code> (default): exact set to 1 if there is an attribute containing a string equals to the query</p></li>
2012+
</ul>
2013+
2014+
</td>
2015+
</tr>
2016+
2017+
2018+
<tr>
2019+
<td valign='top'>
2020+
<div class='client-readme-param-container'>
2021+
<div class='client-readme-param-container-inner'>
2022+
<div class='client-readme-param-name'><code>alternativesAsExact</code></div>
2023+
<div class="client-readme-param-meta"><div><em>Type: <strong>string array</strong></em></div><div><em>Default: <strong>["ignorePlurals", "singleWordSynonym"]</strong></em></div></div>
2024+
</div>
2025+
</div>
2026+
</td>
2027+
<td class='client-readme-param-content'>
2028+
<p>Specify the list of approximation that should be considered as an exact match in the ranking formula:</p>
2029+
2030+
<ul>
2031+
<li><p><code>ignorePlurals</code>: alternative words added by the ignorePlurals feature</p></li>
2032+
<li><p><code>singleWordSynonym</code>: single-word synonym (For example &quot;NY&quot; = &quot;NYC&quot;)</p></li>
2033+
<li><p><code>multiWordsSynonym</code>: multiple-words synonym (For example &quot;NY&quot; = &quot;New York&quot;)</p></li>
2034+
</ul>
18892035

18902036
</td>
18912037
</tr>

0 commit comments

Comments
 (0)