Index
1List<JSONObject> array = new ArrayList<JSONObject>(); 2array.add( 3 new JSONObject() 4 .put("firstname", "Jimmie") 5 .put("lastname", "Barninger") 6 .put("objectID", "myID") 7); 8array.add( 9 new JSONObject() 10 .put("firstname", "Warren") 11 .put("lastname", "Speach") 12 .put("objectID", "myID2") 13); 14 15index.saveObjectsAsync(new JSONArray(array), null);
Search
1Index index = client.getIndex("contacts"); 2 3// Add settings 4Query query = new Query("query string") 5 .setAttributesToRetrieve("firstname", "lastname") 6 .setHitsPerPage(50); 7 8// Perform search 9index.searchAsync(query, new CompletionHandler() { 10 @Override 11 public void requestCompleted(JSONObject content, AlgoliaException error) { 12 // [...] 13 } 14});
Starter for product search powered by Algolia InstantSearch
Typeahead dropdown playground built with the Algolia Autocomplete library
Starter for video search powered by Algolia InstantSearch