Robert Hulme wrote: >> I've implemented a field_scores hash that can be returned along with >> each document and aggregate score. It's only currently working in >> Ferret 0.11.4. > Could you please give a code example of how to do a query and get the > field_scores hash? > > I have Ferret 0.11.6.
Rob, FerretResult objects are given a ferret_field_scores attribute, which is an array (not a hash, as I said above) of field_score objects, in order of decreasing score. Field_score objects have "field" and "score" attributes. You specify which fields you want to see the field scores for by adding the field_info option :field_score => :yes. You can use field_scores to display an extract of the field that best matches the user's query: @result.highlight @query, :field => @result.ferret_field_scores.first.field It'd take some work to port it to Ferret 0.11.6, though I will do this soon. _______________________________________________ Ferret-talk mailing list [email protected] http://rubyforge.org/mailman/listinfo/ferret-talk

