Best way and practices to implement search

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?

Thanks!

Thinking Sphinx seems to be way to go for a configurable real text
search engine. Here’s a railscasts.com screencast with links:

Sheldon Finlay

Sheldon Finlay wrote:

Thinking Sphinx seems to be way to go for a configurable real text
search engine. Here’s a railscasts.com screencast with links:

#120 Thinking Sphinx - RailsCasts

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

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

This is silly in modern Web architecture, because Mongrel (or mod-rails,
or
Passenger) already are daemons, so a search system could simply ride
around
inside your Ruby vm as a @@class_instance of some controller. Its index
would
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
have
“decayed”. They would fail for no reason, out of the blue, on the test
server,
when we were busy working on something else, and we would comment them
out.
Almost none are still online, and that is a very bad omen.

Sphinx’s authors could simply provide an in-memory version…


Phlip