Forum: Ruby on Rails Best way and practices to implement search

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
798c7f10aed317c27155ba7c53221df6?d=identicon&s=25 Gu stav (gustav)
on 2009-01-20 05:21
I'm trying to implement a search engine to look thru some stuff in my
models. Is there a way I can do something similar to Model.find, but
that is more "forgiving" (poor spelling etc.) and also leverages the
relationships that I've specified (so that it also searches has_many or
belongs_to models)?

Do you have any suggestions on how to implement this. Are there any good
plugins or do I have to write it by myself?

59dc433a45056794ddc39e3623e91c46?d=identicon&s=25 Sheldon Finlay (Guest)
on 2009-01-20 06:17
(Received via mailing list)
Thinking Sphinx seems to be way to go for a configurable real text
search engine. Here's a screencast with links:

Sheldon Finlay
Aafa8848c4b764f080b1b31a51eab73d?d=identicon&s=25 Phlip (Guest)
on 2009-01-20 06:32
(Received via mailing list)
Sheldon Finlay wrote:
> Thinking Sphinx seems to be way to go for a configurable real text
> search engine. Here's a screencast with links:

I liked Sphinx, and wrote it up, but it has turned out to be a real itch

Sphinx requires its own daemon running in another process. That makes
unit tests
extremely difficult to keep clean. They must configure data, start the
run it reliably, and stop it on command.

This is silly in modern Web architecture, because Mongrel (or mod-rails,
Passenger) already are daemons, so a search system could simply ride
inside your Ruby vm as a @@class_instance of some controller. Its index
persist in memory long enough to be efficient at search time - that is
the point
of a persistent daemon process.

I intend to look at SearchLogic as soon as possible - formerly
"Searchgasm" - to
see if it's lighter than Sphinx. Over time, all of our Sphinx unit tests
"decayed". They would fail for no reason, out of the blue, on the test
when we were busy working on something else, and we would comment them
Almost none are still online, and that is a very bad omen.

Sphinx's authors could simply provide an in-memory version...

This topic is locked and can not be replied to.