Hi Jens,
thanks a lot for reminding me that distilling a simple test case can
help clearing up things quickly. I was buried so deep in my own code
that I couldn't see the obvious.
Turns out there is a problem with a custom analyzer of mine. It works
OK and passed all tests but it seems that Ferret isn't using the same
analyzer for searching and indexing although I've arranged for it. Or
so I thought.
I still haven't found the culprit but you put me on the right track
anyway.
Thanks,
Andy
On 11.07.2007, at 14:36, Jens Kraemer wrote:
> require 'rubygems'
> require 'ferret'
>
> include Ferret
>
> fi = Index::FieldInfos.new
> fi.add_field :country_code
> fi.add_field :city, :boost => 8
> fi.add_field :district, :boost => 7
> i = Ferret::I.new :field_infos => fi
>
> i << { :country_code => 'de', :city => 'Berlin' }
> i << { :country_code => 'de', :city => 'Seedorf', :district =>
> 'Berlin' }
>
> i.search_each 'berlin, de' do |hit,score|
> puts "#{i[hit][:country_code]} #{i[hit][:district]} #{i[hit]
> [:city]} Score: #{score}"
> end
>
> this outputs
> de Berlin Score: 0.841327428817749
> de Berlin Seedorf Score: 0.740611553192139
>
> Swapping the boost values (city:7, district:8) also changes the result
> sorting.
>
> Any more info on other circumstances that might cause your problems?
_______________________________________________
Ferret-talk mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/ferret-talk