We're using acts_as_ferret on a column called 'body' which normally has html markup in it. We want to continue to store the markup in our database, but we want to remove the markup from that field before Ferret indexes it. We're thinking there would be an option to intercept the value that Ferret is indexing, for pre-processing, but we can't find it. So we either need to know how Ferret might support this requirement, or, we think we can skip the acts_as_ferret altogether and manually call LocalIndex.add or something like that and therefore have more control over what's being indexed. Thanks.
on 2008-10-02 20:00
on 2008-10-28 20:41
Hi!
add a 'virtual field' to your index that contains the value without
markup, i.e.
class YourModel
acts_as_ferret :fields => [ ;title, :body_searchable ]
def body_searchable
strip_markup(self.body)
end
end
Cheers,
Jens
Gaudi Mi wrote:
> We're using acts_as_ferret on a column called 'body' which normally has
> html markup in it. We want to continue to store the markup in our
> database, but we want to remove the markup from that field before Ferret
> indexes it. We're thinking there would be an option to intercept the
> value that Ferret is indexing, for pre-processing, but we can't find it.
>
> So we either need to know how Ferret might support this requirement, or,
> we think we can skip the acts_as_ferret altogether and manually call
> LocalIndex.add or something like that and therefore have more control
> over what's being indexed.
>
> Thanks.
Please log in before posting. Registration is free and takes only a minute.
Existing account
(Switch to SSL-encrypted connection)
NEW: Do you have a Google/GoogleMail or Yahoo account? No registration required!
Log in with Google account | Log in with Yahoo account
Log in with Google account | Log in with Yahoo account
No account? Register here.