# Advanced search for a model (including keywords)

**URL:** <https://www.ruby-forum.com/t/advanced-search-for-a-model-including-keywords/163860>\
**Category:** Rails\
**Created:** [March 25, 2009, 4:06pm UTC](https://www.ruby-forum.com/t/advanced-search-for-a-model-including-keywords/163860 "2009-03-25T16:06:45Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![aupayo](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/7ab992/32.png) [@aupayo](https://www.ruby-forum.com/u/aupayo)\
**Post date:** [March 25, 2009, 4:06pm UTC](https://www.ruby-forum.com/t/advanced-search-for-a-model-including-keywords/163860/1 "2009-03-25T16:06:45Z")

</div>

Hello,

I am new in rails and I am working in an application which requires  
advanced search.  
I have a model called Item which has various attributes like “weight”,  
“price”, “category”, “age”…and then it has some “keywords”,  
describing the Item.

I would like to implement an advanced search where the users can  
search Items using the attributes that they want.

After googling some time, I found that:

- acts\_as\_taggable could be useful for the “keywords” attribute.
- acts\_as\_ferret could be useful for searching the tags (I would need  
to search for multiple tags in the same query, include some fuzzy  
search…)
- Searchlogic would be very useful to implement the search with all  
the attributes, but I am not sure if it can cope with the  
acts\_as\_taggable plugin, or if I should implement the keywords just  
using a String attribute, or how to do it.

Well, I know I have a lot of work to do, but I would really appreciate  
if someone could give me some hints in order to point the direction in  
which I should work. Which is the best way (or simplest) in your  
opinion to implement this search?

The application will have to deal with “many” records (lets say  
100.000), so I would also appreciate receiving some comments regarding  
speed…however it doesn’t have to be the faster app in the world, in  
this moment I prefer an easier development and I’ll improve the app in  
the future if needed.

Thanks a lot for your help.

---

<div class="post-metadata">

**Author:** ![aupayo](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/7ab992/32.png) [@aupayo](https://www.ruby-forum.com/u/aupayo)\
**Post date:** [March 25, 2009, 5:48pm UTC](https://www.ruby-forum.com/t/advanced-search-for-a-model-including-keywords/163860/2 "2009-03-25T17:48:18Z")

</div>

It’s really basic search you’re looking for. 100,000 records is not  
that many, use acts\_as\_ferret with a local index and you’ll be fine  
for quite a while.

---

<div class="post-metadata">

**Author:** ![aupayo](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/7ab992/32.png) [@aupayo](https://www.ruby-forum.com/u/aupayo)\
**Post date:** [March 25, 2009, 7:30pm UTC](https://www.ruby-forum.com/t/advanced-search-for-a-model-including-keywords/163860/3 "2009-03-25T19:30:39Z")

</div>

I personally had many issues trying to use Ferret and would recommend  
Sphinx with thinking sphinx plugin.

---

<div class="post-metadata">

**Author:** ![aupayo](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/7ab992/32.png) [@aupayo](https://www.ruby-forum.com/u/aupayo)\
**Post date:** [June 9, 2009, 6:27pm UTC](https://www.ruby-forum.com/t/advanced-search-for-a-model-including-keywords/163860/4 "2009-06-09T18:27:54Z")

</div>

Searchlogic is very plugin for search and i hoped it would help me  
better in pagination but pagination is not at all working.

Any pupil facing such type of errors.  
Thanks in advance

---

<div class="post-metadata">

**Author:** ![aupayo](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/7ab992/32.png) [@aupayo](https://www.ruby-forum.com/u/aupayo)\
**Post date:** [March 25, 2009, 11:12pm UTC](https://www.ruby-forum.com/t/advanced-search-for-a-model-including-keywords/163860/5 "2009-03-25T23:12:37Z")

</div>

And, besides using ferret or sphinx, should I also use  
acts\_as\_taggable in order to manage the keywords for each item?
