On Fri, Mar 09, 2007 at 05:06:08AM +0100, Ben wrote:
> Hi,
> 
> I've been having a problem getting highlighting to work with aaf.
> 
> I have a class defined as follows such:
> 
> class Link < ActiveRecord::Base
>   acts_as_ferret :fields => { :description => { :store => :yes } }
> end
> 
> I get back the correct results when I do Link.find_by_contents, however,
> I'd like to highlight them.
> 
> If I do something like iterate through the list of results and call
> result.highlight("myquery", :field => :description), but this is
> returning nil for each result. How is this possible if these results are
> correctly returned because "myquery" is a token in their description? Am
> I incorrectly using the api?

your usage of the api is perfectly right. I'm not sure what's going on
there, and can't reproduce this here.

To help debug this a bit, could you please try this in the console:

results = Link.find_by_contents(query)
result = results.first
result.highlight(query, :field => :description) # returns nil

doc_num = result.document_number

# if you are on aaf trunk:
Link.aaf_index.ferret_index.highlight(query, doc_num, :field => :description)
# if on aaf stable:
Link.ferret_index.highlight(query, doc_num, :field => :description)


this would directly use ferret's highlight method. Btw, what version of
aaf do you use?

Jens

-- 
Jens Krämer
webit! Gesellschaft für neue Medien mbH
Schnorrstraße 76 | 01069 Dresden
Telefon +49 351 46766-0 | Telefax +49 351 46766-66
[EMAIL PROTECTED] | www.webit.de
 
Amtsgericht Dresden | HRB 15422
GF Sven Haubold, Hagen Malessa
_______________________________________________
Ferret-talk mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/ferret-talk

Reply via email to