Skip to content

Commit

Permalink
docs(readme): clarify which API key to use (#723)
Browse files Browse the repository at this point in the history
* docs(readme): clarify which API key to use

fixes #722

* Update README.md
  • Loading branch information
Haroenv committed Oct 1, 2018
1 parent 8702d1e commit 1634983
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions README.md
Expand Up @@ -162,6 +162,8 @@ var client = algoliasearch('applicationID', 'apiKey');

Without any prior configuration, you can start indexing [500 contacts](https://github.com/algolia/datasets-public/blob/master/contacts/contacts.json) in the `contacts` index using the following code:

> for this use: [**admin** API key](https://www.algolia.com/doc/guides/security/api-keys/#admin-api-key) in client instantiation
```js
var index = client.initIndex('contacts');
var contactsJSON = require('./contacts.json');
Expand All @@ -177,6 +179,8 @@ index.addObjects(contactsJSON, function(err, content) {

You can now search for contacts using firstname, lastname, company, etc. (even with typos):

> for this use: [**search only** API key](https://www.algolia.com/doc/guides/security/api-keys/#search-only-api-key) in client instantiation
```js
// firstname
index.search('jimmie', function(err, content) {
Expand All @@ -203,6 +207,8 @@ index.search('jimmie paint', function(err, content) {

Settings can be customized to tune the search behavior. For example, you can add a custom sort by number of followers to the already great built-in relevance:

> for this use: [**admin** API key](https://www.algolia.com/doc/guides/security/api-keys/#admin-api-key) in client instantiation
```js
index.setSettings({
'customRanking': ['desc(followers)']
Expand Down

0 comments on commit 1634983

Please sign in to comment.