Skip to content

Commit

Permalink
Add notes about the JS API client
Browse files Browse the repository at this point in the history
  • Loading branch information
redox committed Jul 28, 2014
1 parent 9ed0f2d commit 425a539
Showing 1 changed file with 32 additions and 1 deletion.
33 changes: 32 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,33 @@ System.out.println(index.search(new Query("jim")));
```


**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:
* your users get a better response time by avoiding to go through your servers,
* it will offload your servers of unnecessary tasks.

```html
<script type="text/javascript" src="//path/to/algoliasearch.min.js"></script>
<script type="text/javascript">
var client = new AlgoliaSearch("YourApplicationID", "YourSearchOnlyAPIKey");
var index = client.initIndex('YourIndexName');
function searchCallback(success, content) {
if (success) {
console.log(content);
}
}
// perform query "jim"
index.search("jim", searchCallback);
// the last optional argument can be used to add search parameters
index.search("jim", searchCallback, { hitsPerPage: 5, facets: '*', maxValuesPerFacet: 10 });
</script>
```






Documentation
Expand Down Expand Up @@ -228,7 +255,11 @@ index.partialUpdateObject(new JSONObject().put("city", "San Francisco"), "myID")

Search
-------------
**Opening note:** 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 send queries. It brings two benefits: (i) your users get a better response time by avoiding to go through your servers, and (ii) it will offload your servers of unnecessary tasks.

**Opening note:** 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 send queries. It brings two benefits:
* your users get a better response time by avoiding to go through your servers,
* and it will offload your servers of unnecessary tasks.


To perform a search, you just need to initialize the index and perform a call to the search function.

Expand Down

0 comments on commit 425a539

Please sign in to comment.