# Search technique

**URL:** <https://www.ruby-forum.com/t/search-technique/107514>\
**Category:** Rails\
**Created:** [June 22, 2007, 1:15pm UTC](https://www.ruby-forum.com/t/search-technique/107514 "2007-06-22T13:15:13Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![arun123](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/58f4c7/32.png) [@arun123](https://www.ruby-forum.com/u/arun123)\
**Post date:** [June 22, 2007, 1:15pm UTC](https://www.ruby-forum.com/t/search-technique/107514/1 "2007-06-22T13:15:13Z")

</div>

hello all,

I need to implement search in my app. any one guide me which search  
technique or plugin or gem is good for it.  
the search must be too fast. i used ferret before. but if there is any  
good  
other than this then please reply me.

## Thanks

Arun A.

---

<div class="post-metadata">

**Author:** ![arun123](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/58f4c7/32.png) [@arun123](https://www.ruby-forum.com/u/arun123)\
**Post date:** [June 22, 2007, 5:11pm UTC](https://www.ruby-forum.com/t/search-technique/107514/2 "2007-06-22T17:11:39Z")

</div>

Arun,

There are several search options out there, but I suggest you looking at  
acts\_as\_solr ([http://acts-as-solr.railsfreaks.com](http://acts-as-solr.railsfreaks.com)), it adds full text  
search capabilities and many other nifty features from Apacheâ€˜s Solr to  
any Rails model. The current release is 0.9 and the features include:

- Advanced Full-Text Search Capabilities
- Optimized for Low to High Volume Web Traffic
- Faceted Search: easy implementation of faceted navigation system that  
enables a user to navigate the search results hierarchically
- Indexing of Single Table Inheritances (STI’s)
- Start and stop the Solr server with a simple rake command
- Indexing of any custom method defined in you models
- Ability of having multiple Solr instances running in the same servlet
- You have the option to specify the field types when indexing if youâ€˜d  
like to preserve its original Solr field type
- Multi-model search, which can be used to execute a search across  
multiple models
- Model association indexing: you can include any :has\_one, :has\_many,  
:belongs\_to and :has\_and\_belongs\_to\_many association to be indexed
- Boosting support for the entire document and/or on a per-field basis
- Support for models that don’t use integer ids as the primary field

–  
Thiago J.  
acts\_as\_solr =\> [http://acts-as-solr.railsfreaks.com](http://acts-as-solr.railsfreaks.com)

Arun A. wrote:

> hello all,
> 
> I need to implement search in my app. any one guide me which search  
> technique or plugin or gem is good for it.  
> the search must be too fast. i used ferret before. but if there is any  
> good  
> other than this then please reply me.
> 
> ## Thanks
> 
> Arun A.

---

<div class="post-metadata">

**Author:** ![arun123](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/58f4c7/32.png) [@arun123](https://www.ruby-forum.com/u/arun123)\
**Post date:** [June 25, 2007, 12:58pm UTC](https://www.ruby-forum.com/t/search-technique/107514/3 "2007-06-25T12:58:25Z")

</div>

any idea about ferret…?

On 22/06/07, Thiago J. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> - Optimized for Low to High Volume Web Traffic
> - Model association indexing: you can include any :has\_one, :has\_many,
> 
> > ## hello all, Thanks
> > 
> > Arun A.
> 
> –  
> Posted via [http://www.ruby-forum.com/](http://www.ruby-forum.com/).
> 
> >

–  
Arun A.

---

<div class="post-metadata">

**Author:** ![arun123](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/58f4c7/32.png) [@arun123](https://www.ruby-forum.com/u/arun123)\
**Post date:** [June 25, 2007, 3:44pm UTC](https://www.ruby-forum.com/t/search-technique/107514/4 "2007-06-25T15:44:11Z")

</div>

On Mon, Jun 25, 2007 at 04:27:36PM +0530, Arun A. wrote:

> any idea about ferret…?

with acts\_as\_ferret ([http://projects.jkraemer.net/acts\_as\_ferret](http://projects.jkraemer.net/acts_as_ferret)) Ferret  
can do all the things stated below, minus the need for a Java server 🙂

And you don’t need a search server running at all when doing local  
development and testing - the server component is only needed for  
production usage.

Btw, what exactly does ‘Optimized for Low to High Volume Web Traffic’  
mean?

Cheers,  
Jens

> On 22/06/07, Thiago J. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:
> 
> >

[…]

> > like to preserve its original Solr field type
> > 
> > - Multi-model search, which can be used to execute a search across  
> > multiple models
> > - Model association indexing: you can include any :has\_one, :has\_many,  
> > :belongs\_to and :has\_and\_belongs\_to\_many association to be indexed
> > - Boosting support for the entire document and/or on a per-field basis
> > - Support for models that don’t use integer ids as the primary field

–  
Jens Krämer  
[http://www.jkraemer.net/](http://www.jkraemer.net/) - Blog  
[http://www.omdb.org/](http://www.omdb.org/) - The new free film database

---

<div class="post-metadata">

**Author:** ![arun123](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/58f4c7/32.png) [@arun123](https://www.ruby-forum.com/u/arun123)\
**Post date:** [June 26, 2007, 9:30am UTC](https://www.ruby-forum.com/t/search-technique/107514/5 "2007-06-26T09:30:48Z")

</div>

On 25 Jun 2007, at 15:43, Jens K. wrote:

> mean?  
> Ferret is fine for low traffic sites, but once traffic goes up,  
> things start to happen. I’m sure people on this list will know the  
> disastrous “segmentation fault” errors ferret is well known for. The  
> latest version of ferret has dealt with a lot of these bugs, so  
> things should be better. Also, ferret has no way of splitting up your  
> indexing to balance it over another server. All in all, I’ve switched  
> from ferret to solr and although I’m not a big java fan because of  
> its memory consumption, solr and the real lucene behind it blow away  
> ferret both in terms of speed and reliability.

Best regards

Peter De Berdt

---

<div class="post-metadata">

**Author:** ![arun123](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/58f4c7/32.png) [@arun123](https://www.ruby-forum.com/u/arun123)\
**Post date:** [June 26, 2007, 12:32pm UTC](https://www.ruby-forum.com/t/search-technique/107514/6 "2007-06-26T12:32:11Z")

</div>

On 26 Jun 2007, at 11:17, Jens K. wrote:

> Thank you 🙂  
> Point taken 🙂

My experiences date back some time and my company has been the victim  
of corrupted indexes, but having read the entry in your wiki (http://  
[projects.jkraemer.net/acts\_as\_ferret/wiki/DrbServer](http://projects.jkraemer.net/acts_as_ferret/wiki/DrbServer)) makes me  
consider ferret again to be honest. As I said, I’m not a big fan of  
java because of its memory consumption and ease of use, but when our  
app went haywire all the time, I went for solr running as a Tomcat  
servlet and am still very happy with its performance.

On the other hand, acts\_as\_solr seems to have some new features that  
are not in acts\_as\_ferret (and can come in handy).

Dilemmas, I really hate em 🙂 Anyway, thx for your input, good food  
for thought 😉

Best regards

Peter De Berdt

---

<div class="post-metadata">

**Author:** ![arun123](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/58f4c7/32.png) [@arun123](https://www.ruby-forum.com/u/arun123)\
**Post date:** [June 26, 2007, 11:17am UTC](https://www.ruby-forum.com/t/search-technique/107514/7 "2007-06-26T11:17:58Z")

</div>

On Tue, Jun 26, 2007 at 09:29:40AM +0200, Peter De Berdt wrote:

> > production usage.
> > 
> > Btw, what exactly does ‘Optimized for Low to High Volume Web Traffic’  
> > mean?
> 
> Ferret is fine for low traffic sites, but once traffic goes up,  
> things start to happen. I’m sure people on this list will know the  
> disastrous “segmentation fault” errors ferret is well known for. The  
> latest version of ferret has dealt with a lot of these bugs, so  
> things should be better.

Recent Ferret only segfaults or corrupts the index when multiple  
processes write-access the index at the same time. This is a well-known  
and discussed issue and one that can easily be solved by doing the  
indexing with a single process, i.e. some backend server solution just  
as solr is one, too.

> Also, ferret has no way of splitting up your indexing to balance it  
> over another server.

Right, Ferret doesn’t have that feature. I didn’t miss it, yet.

> All in all, I’ve switched from ferret to solr and although I’m not a  
> big java fan because of its memory consumption, solr and the real  
> lucene behind it blow away ferret both in terms of speed and  
> reliability.

Acts\_as\_ferret brings an indexing server that will handle all indexing  
in production environments, so you’ll see no segfaults or other problems  
at all. Plus you get features like index versioning and background  
rebuilds.

For the speed, Solr and acts\_as\_ferret/DRb seem to be pretty up to par,  
with a slight advantage for Ferret according to this benchmark (not done  
by me, but by a user of aaf):

> **[Benchmarking acts\_as\_ferret and acts\_as\_solr](http://calebjones.blogspot.com/2007/03/benchmarking-actsasferret-and.html)**
>
> The Problem I've been a fan of the acts\_as\_ferret plugin for a while and have had great success in using it while developing Rails applicat...

I’m not at all into search engine flamewars, but please hold to the  
facts and don’t post any unproven generalized speed estimates.  
Thank you 🙂

Regarding the stability you might like to have a look at projects like  
[omdb.org](http://omdb.org) which runs Ferret for lots of live searches and the main site  
search. it has a background indexer that is busy reindexing stuff as  
soon as something on the page is changed - it runs without a single  
hickup for months now. The project’s code is MIT licensed, so you can  
even have a look at how it’s done under the hood.

cheers,  
Jens

–  
Jens Krämer  
[http://www.jkraemer.net/](http://www.jkraemer.net/) - Blog  
[http://www.omdb.org/](http://www.omdb.org/) - The new free film database
