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.
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.
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 K. wrote:
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
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.
i agree to that… it might not be a problem, if you have a static index
that never changes. but as soon as your index evolves, you will find
yourself in a situation where an index rebuild is necessary.
The permanent data is going to be stored separately but as data is
parsed
into fragments before indexing, it isn’t a very good idea to rebuild the
index…However, i was looking at rails just to provide the front-end to
the
indexing and searching that would go on in the backend, which doesn’t
really
justify it’s usage but i thought it would probably give more flexibility
dealing with the index…I am hoping to make a model based on an index so
it
can communicate easily with the core program and work it out from there,
but
it’ll need some reading as I only started rails today…
–
The dumb’s song to the deaf is exactly what music is to us.
The best things in the world are free.
A foolish dreamer who knows reality is more vague than a dream and that
a
song’s “realer” than the same makes reality.
Pulkit Bhuwalka
Dept. Of Information Science
BMS College Of Engineering, Bangalore
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.