On 10/10/06, Chris Kilmer <[EMAIL PROTECTED]> wrote:
> I was having some odd results when working with acts_as_ferret (current
> trunk), so I decided to test with the current version of ferret to see
> if I encountered the same problem. I did. Here are the details:
>
> installed ferret 0.10.10 on debian sarge with 'sudo gem install ferret'
> (btw, same results on OSX)
>
> opened up an irb session:
>
>
> irb(main):001:0> require 'rubygems'
> => true
> irb(main):002:0> require 'ferret'
> => true
> irb(main):003:0> include Ferret
> => Object
>
> irb(main):004:0> i = Ferret::I.new
> => #<Ferret::Index::Index:0xb77dc1f4 @options={:default_field=>:*,
> :dir=>#<Ferret::Store::RAMDirectory:0xb77dc1b8>,
> :analyzer=>#<Ferret::Analysis::StandardAnalyzer:0xb77dc0c8>,
> :lock_retry_time=>2}, @mon_entering_queue=[], @qp=nil, @searcher=nil,
> @mon_count=0, @default_field=:*, @close_dir=true, @auto_flush=false,
> @open=true, @mon_owner=nil, @id_field=:id, @reader=nil,
> @mon_waiting_queue=[], @writer=nil, @default_input_field=:id,
> @dir=#<Ferret::Store::RAMDirectory:0xb77dc1b8>>
>
> *** Now let's add 3 strings to the index ***
>
> irb(main):005:0> ["While you were out pet care", "Eastside dog walker",
> "Top daw
> g dog walker"].each {|text| i << text }
> => ["While you were out pet care", "Eastside dog walker", "Top dawg dog
> walker"]
>
> *** Now let's do some searches ***
>
> irb(main):006:0> puts i.search('pet')
> TopDocs: total_hits = 1, max_score = 0.878416 [
> 0 "While you were out pet care": 0.878416
> ]
> => nil
>
> irb(main):007:0> puts i.search('dog')
> TopDocs: total_hits = 2, max_score = 0.500000 [
> 1 "Eastside dog walker": 0.500000
> 2 "Top dawg dog walker": 0.500000
> ]
> => nil
>
> irb(main):008:0> puts i.search('dawg')
> TopDocs: total_hits = 1, max_score = 0.702733 [
> 2 "Top dawg dog walker": 0.702733
> ]
> => nil
>
> irb(main):010:0> puts i.search('cat')
> TopDocs: total_hits = 0, max_score = 0.000000 [
> ]
> => nil
>
> *** The previous 4 searches gave expected results. Notice that search
> for 'cat' returned nothing (as it should) ***
>
> *** Let's add some more strings to the index. They are the same, but
> does it matter? ***
>
>
> irb(main):010:0> ["While you were out pet care", "Eastside dog walker",
> "Top dawg
> g dog walker"].each { |text| i << text }
> => ["While you were out pet care", "Eastside dog walker", "Top dawg dog
> walker"]
> irb(main):011:0> ["While you were out pet care", "Eastside dog walker",
> "Top dawg
> g dog walker"].each { |text| i << text }
>
> *** Once again, do a search for 'cat'. ***
>
> puts i.search('cat')
> TopDocs: total_hits = 2, max_score = 1.395880 [
> 2 "Top dawg dog walker": 1.395880
> 5 "Top dawg dog walker": 1.395880
> ]
> => nil
>
>
> *** The last search returned two results for 'cat', which is incorrect
> ***
>
> It seems I can add any number of items to an index once without a
> problem. However, once I add more items to the index, I start getting
> incorrect resuts. Can anybody shed some light on the issue? Any help
> would be appreciated.
>
Hi Chris,
That is definitely a bug. I'll look into it.
Cheers,
Dave
_______________________________________________
Ferret-talk mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/ferret-talk