On Sun, Sep 03, 2006 at 10:30:24PM +0200, Jean-Christophe Michel wrote:
> Hi Dave,
>
> Le 3 sept. 06, à 15:26, David Balmain a écrit :
> > I've added a highlight method to Ferret::Index::Index so you'll be
> > able to use it now.
>
> Thanks. Trying to use this, I updated to 0.10.2 gem.
> But I cannot get highlight return something else than nil.
> I suspect highly the doc id not always being my indexed class id,
> though aaf code seems to create docs with Model.id :/
the ferret document id is *not* your Model primary key id. retrieving
the doc id from a given primary key isn't that easy atm, since aaf's
find_by_contents returns model instances and no doc ids.
Model.ferret_index.search("id:#{model.id}")
should give you access to the ferret search results and therefore the
document ids.
I'll add better support for this to aaf soon. I've been thinking about
something like
model_instance.highlight('rare_word', :field => :my_field)
Jens
--
webit! Gesellschaft für neue Medien mbH www.webit.de
Dipl.-Wirtschaftsingenieur Jens Krämer [EMAIL PROTECTED]
Schnorrstraße 76 Tel +49 351 46766 0
D-01069 Dresden Fax +49 351 46766 66
_______________________________________________
Ferret-talk mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/ferret-talk