Pulkit wrote:
>> I've used ruby and ferret for the past one month to index resumes.
>> Now I need a web front-end to the application and the obvious
>> choice turns out to be rails. But as I'm not interested in using a
>> database and intend to just use the index, I'm not sure as to how
>> to put it into the MVC framework as the model implicitly takes a
>> database. Is there a way it can take an index instead by using
>> acts_as_ferret.

Benjamin Krause wrote:
> There are other web frameworks (like 
> http://code.whytheluckystiff.net/shoes/) so you don't necessarily
> need to use rails. However, even in Rails you model classes must not
> inherit from ActiveRecord. It's just that all tutorials, screencasts,
> etc. focus on db-model classes. Its perfectly fine to create a non-db
> model class (based on Object), that acts as a wrapper for ferret.
> 
> acts_as_ferret is just a bridge between you db objects and ferret. so
> if you do not have db objects (and therefore don't inherit from AR),
> you can't use acts_as_ferret (at least not without some non-trivial
> changes).
> 
> I would suggest to build a ferret-model-object that handels all
> search requests.

Stuart Sierra replies:
I did something similar to this with a model class that stored
everything in XML files and used Ferret for searching.  To make it 
easier to use with Rails, I imitated some of the methods of 
ActiveRecord::Base, like find().  It was a bit cumbersome, but it worked.

The only problem is, as this list demonstrates, Ferret indexes aren't 
always the most reliable place to store your data.  I'd advise keeping a 
permanent copy in files or a database somewhere so you can rebuild the 
index if it gets corrupted or when the Ferret version changes.
-S
_______________________________________________
Ferret-talk mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/ferret-talk

Reply via email to