I started working on a project that needed a full-text search in Ruby, so naturally I started with Solr + Sunspot, but I couldn't get it to work. It was a pain, just linking them, then I tried to find out if the document was indexed correctly, find out the path to the runtime so that I could add additional analyzer / tokenizer classes by editing the config.xml / schema.xml file, etc. Solr numDocs clearly said that it received and indexed them, but I could not get the results of the query. I just gave up in a couple of days, it was a kind of Adventure configuration.
ElasticSearch + Tire was fresh to start and run, I earned it in an hour.
Lucene is just a Java search library, so Solr was designed as an application to fully search for a service, but Solr still has all the capabilities of capturing a typical Java Webapp: overly complex XML configurations, heavy schemas, expect XML documents for indexing, container required Java servlets (Jetty or Tomcat), which just gets too many errors for me.
ElasticSearch is based on Lucene, it has a built-in servlet container, so it starts as a daemon, uses a very simple JSON + REST API, so it is great for testing and more natural for Ruby. This is sketchy, and it worked for me without even editing the configuration file. Everything worked perfectly.
I really needed a Chinese search, and ElasticSearch already packaged Luecene SmartChineseAnalyzer as a plugin. Not sure how difficult it will be to configure the analyzer / tokenizer chain if you need this level of customization. Docs for ElasticSearch and Tire are first-class solutions.
Bus (Ruby library for ElasticSearch)
https://github.com/karmi/tire
You can try the demo, install the searchapp rails, download the ElasticSearch binary and run it, and then run Webrick automatically.
$ rails new searchapp -m https://raw.github.com/karmi/tire/master/examples/rails-application-template.rb
On my system, he complained that I didn’t have a Javascript mechanism (Rails 3.2 no longer includes a default stone descriptor), so I had to:
$ wget https://raw.github.com/karmi/tire/master/examples/rails-application-template.rb $ nano rails-application-template.rb
add the gem 'therubyracer' to the file (look for the gem of 'tire' and gem 'will_paginate'), then ...
$ rails new searchapp -m rails-application-template.rb
To develop my own application, I simply changed the tarball ElasticSearch and ran the -f switch in the foreground (so I can easily stop it with Ctrl-C)
$ bin/elasticsearch -f
You can install the eleasksearch-head plugin to get the web admin interface.
https://github.com/mobz/elasticsearch-head
I also found out: if you have one-to-many relationship models, Tire will not allow them for you in the search results, it just returns a flat collection. Your has_many and belongs_to relationships will simply be the identifiers of the objects in the collection, not the complete objects.