DevZona

Rails, Heroku, AWS and other awesome technologies

Delayed Solr Indexing With Sunspot and Resque

| Comments

Overview

So, you had set up your full-text search with WebSolr, sunspot and sunspot_rails. Although it may work perfectly, you can make a couple more tweaks that will improve both application speed and Solr index availability.

By default, Sunspot::Rails will send an update to Solr index after any create/update/delete request. This may take up to 200ms for every request. However, index update is a non-critical operation that may be performed in a background process with the minimal influence on app’s performance.

Using Sunspot for Full Text Search With Pagination and Faceting on API

| Comments

Overview

Virtually every app sooner or later needs some kind of a search, and when it comes to searching against your database, simple SQL LIKE is normally not enough due to a number of reasons (word stemming, speed, etc.) In this case, the obvious solution is full text search.

When it comes to selecting a full text search engine, you have a variety of options. Most popular open source engines are: Apache Solr, Spinx, Elastic Search. Heck, Postgres has it’s own full text search implementation (Ryan Bates has an excellent railscast on it, I will touch on it in later posts). As a Rails developer, I often look for solutions that will easily integrate into Rails app, i.e. I look for Ruby gems. And, when it comes to full text search, you are fortunate. There are plenty of options. sunspot_rails is powered by Apache Solr, thinking_sphinx by Sphinx, and tire by Elastic Search. Moreover, there is at least one Heroku addon for each one of these.