I need some suggestions for the best way to implement search for my
client. They have several models (project, request, usage, etc.) that
they need to search for. Each model will have its own search page
with a form that is similar to the one shown for editing. So the
search needs to be across model fields and the results are limited to
the model.
Some of the model fields will be for associations (like comments) but
again we’re only interested in returning a single model. For some of
the models we also want to filter results based on a parent. For
example, when searching requests we want to limit the requests to a
specific project.
Finally, for one of the models, we need full text searching across
fields (as opposed to a search form with inputs for every field.) The
search is still limited to returning only results for a specific
model. There would also be one or two filters so the user could
explicitly limit a few select fields.
I would really appreciate any suggestions you might have on the
general approach you would use to solve this problem. I’m using Rails
2.1 btw so named scope is available.
I knew about ferret but I had forgotten that you can filter ferret
with conditions (and filtering is key for me.) Turns out you can
filter with something like
We’ve implemented similar searches using acts_as_ferret and it’s been
easy to use, pretty fast and efficient. I’m not 100% about how
scalable it is but I suspect it’ll do very well.
I’d highly recommend it - you should be able to get it up and running
in less than a day.
Dale
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.