Skip to content

Commit 0290cf8

Browse files
Merge pull request #58 from algoliareadmebot/master
Update README
2 parents d82cb02 + 2d1633f commit 0290cf8

File tree

1 file changed

+42
-8
lines changed

1 file changed

+42
-8
lines changed

README.md

Lines changed: 42 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@ Check our [online guides](https://www.algolia.com/doc):
192192
Add a new object to the Index
193193
==================
194194

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

197197
1. Using automatic `objectID` assignment. You will be able to access it in the answer.
198198
2. Supplying your own `objectID`.
@@ -302,7 +302,7 @@ Search
302302

303303
To perform a search, you only need to initialize the index and perform a call to the search function.
304304

305-
The search query allows only to retrieve 1000 hits, if you need to retrieve more than 1000 hits for seo, you can use [Backup / Retrieve all index content](#backup--retrieve-of-all-index-content)
305+
The search query allows only to retrieve 1000 hits, if you need to retrieve more than 1000 hits for seo, you can use [Backup / Retrieve all index content](#backup--export-an-index)
306306

307307
```python
308308
index = client.init_index("contacts")
@@ -961,7 +961,7 @@ You can also use a string array encoding (for example `numericFilters: ["price>1
961961
</div>
962962
</td>
963963
<td class='client-readme-param-content'>
964-
<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>
964+
<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>
965965

966966
<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>
967967

@@ -1045,9 +1045,11 @@ You can also use a string array encoding (for example `numericFilters: ["price>1
10451045
</td>
10461046
<td class='client-readme-param-content'>
10471047
<p>Filter the query with numeric, facet or/and tag filters. The syntax is a SQL like syntax, you can use the OR and AND keywords. The syntax for the underlying numeric, facet and tag filters is the same than in the other filters:
1048-
<code>available=1 AND (category:Book OR NOT category:Ebook) AND public</code>
1048+
<code>available=1 AND (category:Book OR NOT category:Ebook) AND _tags:public</code>
10491049
<code>date: 1441745506 TO 1441755506 AND inStock &gt; 0 AND author:&quot;John Doe&quot;</code></p>
10501050

1051+
<p>If no attribute name is specified, the filter applies to <code>_tags</code>. For example: <code>public OR user_42</code> will translate to <code>_tags:public OR _tags:user_42</code>.</p>
1052+
10511053
<p>The list of keywords is:</p>
10521054

10531055
<ul>
@@ -1109,7 +1111,7 @@ You can send multiple queries with a single API call using a batch of queries:
11091111
# - 1st query targets index `categories`
11101112
# - 2nd and 3rd queries target index `products`
11111113
results = self.client.multiple_queries([{"indexName" : "categories", "query" : myQueryString, "hitsPerPage": 3}
1112-
, {"indexName" : "categories", "query" : myQueryString, "hitsPerPage": 3, "filters": "promotion"}
1114+
, {"indexName" : "categories", "query" : myQueryString, "hitsPerPage": 3, "filters": "_tags:promotion"}
11131115
, {"indexName" : "categories", "query" : myQueryString, "hitsPerPage": 10}])
11141116

11151117
print results["results"]
@@ -1152,12 +1154,12 @@ You can delete an object using its `objectID`:
11521154
index.delete_object("myID")
11531155
```
11541156

1155-
11561157
Delete by query
11571158
==================
11581159

11591160
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.
11601161

1162+
11611163
```python
11621164
params = {}
11631165
index.delete_by_query("John", params)
@@ -1470,6 +1472,38 @@ To get a full description of how the Ranking works, you can have a look at our <
14701472
</tr>
14711473

14721474

1475+
<tr>
1476+
<td valign='top'>
1477+
<div class='client-readme-param-container'>
1478+
<div class='client-readme-param-container-inner'>
1479+
<div class='client-readme-param-name'><code>disablePrefixOnAttributes</code></div>
1480+
<div class="client-readme-param-meta"><div><em>Type: <strong>string array</strong></em></div></div>
1481+
</div>
1482+
</div>
1483+
</td>
1484+
<td class='client-readme-param-content'>
1485+
<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>
1486+
1487+
</td>
1488+
</tr>
1489+
1490+
1491+
<tr>
1492+
<td valign='top'>
1493+
<div class='client-readme-param-container'>
1494+
<div class='client-readme-param-container-inner'>
1495+
<div class='client-readme-param-name'><code>disableExactOnAttributes</code></div>
1496+
<div class="client-readme-param-meta"><div><em>Type: <strong>string array</strong></em></div></div>
1497+
</div>
1498+
</div>
1499+
</td>
1500+
<td class='client-readme-param-content'>
1501+
<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>
1502+
1503+
</td>
1504+
</tr>
1505+
1506+
14731507
<tr>
14741508
<td valign='top'>
14751509
<div class='client-readme-param-container'>
@@ -2180,7 +2214,7 @@ You may have a single index containing **per user** data. In that case, all reco
21802214
```python
21812215
# generate a public API key for user 42. Here, records are tagged with:
21822216
# - 'user_XXXX' if they are visible by user XXXX
2183-
public_key = client.generate_secured_api_key('YourSearchOnlyApiKey', {'filters': 'user_42'})
2217+
public_key = client.generate_secured_api_key('YourSearchOnlyApiKey', {'filters': '_tags:user_42'})
21842218
```
21852219

21862220
This public API key can then be used in your JavaScript code as follow:
@@ -2205,7 +2239,7 @@ You can mix rate limits and secured API keys by setting a `userToken` query para
22052239
```python
22062240
# generate a public API key for user 42. Here, records are tagged with:
22072241
# - 'user_XXXX' if they are visible by user XXXX
2208-
public_key = client.generate_secured_api_key('YourSearchOnlyApiKey', {'filters': 'user_42', 'userToken': 'user_42'})
2242+
public_key = client.generate_secured_api_key('YourSearchOnlyApiKey', {'filters': '_tags:user_42', 'userToken': 'user_42'})
22092243
```
22102244

22112245
This public API key can then be used in your JavaScript code as follow:

0 commit comments

Comments
 (0)