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.
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.