Integrating Algolia Search into a Rails App

Hi All,

I am Janice K.N. Smith, in my day job as a software engineer, I got to use Algolia and I really liked it.

I wanted to try to get it going on a little test project with the minimum set up - and it worked great!

I just wrote a medium article on Integrating Algolia Search into a Rails App.

My write up uses a little scaffolded rails app and outlines how to use the algoliasearch-rails gem to import data to an algolia index.

I link the code at the end of the article, and over all I felt like it was really easy to get up and running!


Hey Janice,

thank you for sharing that, very valuable for the Rails community!

Regarding your code, you can eventually remove a few lines/options that are redundant with what the gem is already doing:

  • no need to specify the “:id” option, by default it uses the ActiveRecord/MongoID id
  • you can specify the index name, but if you don’t the gem will also choose one based on the model class name
  • since the indexing is automatically done at each save, you might don’t need those extra indexing tasks in the rake file

Happy coding!

1 Like

Thanks for sharing @janice.k.n.smith! As someone who likes plants and eats plants I think I would find a plant search quite useful. If you do get around to making a front end I’d be happy to test it out :slight_smile:

:seedling: :herb: :leaves:

Thanks for info! @sylvain, I didn’t realize that that the indexing is done after each save, that is really cool.

@dzello thanks! yeah - I need to make some time for a front end, the data set I found is pretty neat. When I do get to set up a front end, I will update here!