Full text search for Rails 3
Asked Answered
C

4

6

I’m evaluating full text search methods for Rails 3 ATM. Does anyone here have a recommendation? Seems to me as if most of the known methods (Sunspot, Sphinx, Ferret, Xapian) aren’t yet ready for Rails 3. Is that so? At the moment I’ve got plenty of resources left on the machine were I’d like to deploy my app but nevertheless, I’d like to keep the idle load for the search engine as low as possible. I’m planning to use PostgreSQL if that’s of any relevance here.

After some reading I’m almost sure that I’d like to use Sunspot or Xapian. But if there’s any other (and better) solution please tell me :-) Especially regarding Sunspot I’m not sure if it was clever to have a complete Tomcat running in addition to my Rails app. Anyone has experience with this constellation?

Thanks in advance, Ulf

Cosmopolis answered 28/11, 2010 at 15:25 Comment(0)
I
6

If you are using PostgreSQL you can get an awful lot out of its built-in text search capabilities before you need to reach for external libraries. I've been using tsearch queries for years with excellent results.

PostgreSQL full text search analyses word proximity to calculate Relevance & ranking and offers useful features like highlighting of search results.

It is also aware of language specific normalisation rules, for example it knows to ignore the s and es pluralization suffixes in English; so searches for 'country' will also bring back highlighted results for 'countries', much the same way that Google does.

I'm not suggesting that you shouldn't use the libraries that you've mentioned, but it is worth investigating the database to see if will already fulfil the majority, if not all of your requirements.

International answered 28/11, 2010 at 16:32 Comment(2)
I'm pretty happy with this solution. Thanks.Cosmopolis
Thanks ulf. Your comment today is quite a coincidence! I've just this minute been writting a blog post on this very subject (Full Text Search in PostgreSQL). I'll publish it sometime later today.International
L
1

You can use sunspot with Rails3, no problem. We have done so successfully using the sunspot/sunspot_rails gems (1.2.rc4). And it's not too much of a hassle to run Solr within a Tomcat server.

Lisbethlisbon answered 21/12, 2010 at 14:0 Comment(0)
S
0

For fulltext-search features you should use a search engine. For example you could use the Lucene Library with jRuby. If you like to stay with standard Ruby (cRuby) you coud use Solr.

For rails there are also some Solr plugins: For example starting with http://wiki.apache.org/solr/SolRuby could be a good idea.

Stalder answered 28/11, 2010 at 16:7 Comment(0)
B
0

Sunspot is Rails3 ready, we're using it on a few Rails3 apps already. I've had a lot of success with Solr and Sunspot. So much that we're starting a blog series on it

Bisset answered 8/3, 2011 at 15:25 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.