Version
- Supports Ruby version 2.2+
Related Integrations
- Ruby on Rails, Shopify
- InstantSearch for React, Vue, Angular, vanilla
- Autocomplete
Install (get a free account here.)
1gem install algolia
Index
1res = index.save_objects([{ 2 firstname: 'Jimmie', 3 lastname: 'Barninger', 4 objectID: 'myID1' 5}, { 6 firstname: 'Warren', 7 lastname: 'Speach', 8 objectID: 'myID2' 9}])
Search
1index = client.init_index('contacts') 2 3// Search without settings 4res = index.search('query string') 5 6// Search with settings 7res = index.search('query string', { 8 params: { 9 attributesToRetrieve: 'firstname,lastname', 10 hitsPerPage: 20 11 } 12})