You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
**Notes:** If you are building a web application, you may be more interested in using our [JavaScript client](https://github.com/algolia/algoliasearch-client-js) to perform queries. It brings two benefits:
162
-
* Your users get a better response time by not going through your servers
163
-
* It will offload unnecessary tasks from your servers.
**Notes:** If you are building a web application, you may be more interested in using our [JavaScript client](https://github.com/algolia/algoliasearch-client-js) to perform queries. It brings two benefits:
358
-
* Your users get a better response time by not going through your servers
359
-
* It will offload unnecessary tasks from your servers.
360
-
361
337
362
338
To perform a search, you only need to initialize the index and perform a call to the search function.
363
339
@@ -566,7 +542,10 @@ Delete by query
566
542
567
543
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.
568
544
569
-
545
+
```swift
546
+
let query: Query = /* [...] */
547
+
index.deleteByQuery(query, block: nil)
548
+
```
570
549
571
550
572
551
Index Settings
@@ -809,8 +788,6 @@ You can also create an API Key with advanced restrictions:
809
788
* Add a validity period. The key will be valid for a specific period of time (in seconds).
810
789
* Specify the maximum number of API calls allowed from an IP address per hour. Each time an API call is performed with this key, a check is performed. If the IP at the source of the call did more than this number of calls in the last hour, a 403 code is returned. Defaults to 0 (no rate limit). This parameter can be used to protect you from attempts at retrieving your entire index contents by massively querying the index.
811
790
812
-
813
-
814
791
* Specify the maximum number of hits this API key can retrieve in one call. Defaults to 0 (unlimited). This parameter can be used to protect you from attempts at retrieving your entire index contents by massively querying the index.
815
792
* Specify the list of targeted indices. You can target all indices starting with a prefix or ending with a suffix using the '*' character. For example, "dev_*" matches all indices starting with "dev_" and "*_dev" matches all indices ending with "_dev". Defaults to all indices if empty or blank.
You may have a single index containing per user data. In that case, all records should be tagged with their associated user_id in order to add a `tagFilters=(public,user_42)` filter at query time to retrieve only what a user has access to. If you're using the [JavaScript client](http://github.com/algolia/algoliasearch-client-js), it will result in a security breach since the user is able to modify the `tagFilters` you've set by modifying the code from the browser. To keep using the JavaScript client (recommended for optimal latency) and target secured records, you can generate a secured API key from your backend:
887
-
888
-
889
-
890
-
This public API key must then be used in your JavaScript code as follow:
891
-
892
-
```javascript
893
-
<script type="text/javascript">
894
-
var algolia = new AlgoliaSearch('YourApplicationID', '<%= public_api_key %>');
895
-
algolia.setSecurityTags('(public,user_42)'); // must be same than those used at generation-time
You can mix rate limits and secured API keys by setting an extra `user_token` attribute both at API key generation time and query time. When set, a unique user will be identified by her `IP + user_token` instead of only by her `IP`. This allows you to restrict a single user to performing a maximum of `N` API calls per hour, even if she shares her `IP` with another user.
903
-
904
-
905
-
906
-
This public API key must then be used in your JavaScript code as follow:
907
-
908
-
```javascript
909
-
<script type="text/javascript">
910
-
var algolia = new AlgoliaSearch('YourApplicationID', '<%= public_api_key %>');
911
-
algolia.setSecurityTags('(public,user_42)'); // must be same than those used at generation-time
912
-
algolia.setUserToken('user_42') // must be same than the one used at generation-time
0 commit comments