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.
--
Posted via http://www.ruby-forum.com/.
On 10/10/06, Chris Kilmer <christopher.kilmer at biego.com> 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
On 10/10/06, David Balmain <dbalmain.ml at gmail.com> wrote:> On 10/10/06, Chris Kilmer <christopher.kilmer at biego.com> 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) > > > ><snip>recipe to reproduce error</snip> > > > > 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 >Yep, that was a bug introduced in verion 0.10.10. I''ll get a new gem up ASAP. You can get the fixed code from subversion right now if you are in a hurry.
Hi Chris,
can''t reproduce this on windows and ferret 0.10.9.
The following snippet gives these results:
TopDocs: total_hits = 1, max_score = 0.878416 [
0: 0.878416
]
TopDocs: total_hits = 2, max_score = 0.500000 [
1: 0.500000
2: 0.500000
]
TopDocs: total_hits = 1, max_score = 0.702733 [
2: 0.702733
]
TopDocs: total_hits = 0, max_score = 0.000000 [
]
TopDocs: total_hits = 0, max_score = 0.000000 [
]
Snippet:
require ''rubygems''
require ''ferret''
include Ferret
i = Ferret::I.new
["While you were out pet care", "Eastside dog walker",
"Top dawg dog walker"].each {|text| i << text }
puts i.search(''pet'')
puts i.search(''dog'')
puts i.search(''dawg'')
puts i.search(''cat'')
# Let''s add some more strings to the index.
["While you were out pet care", "Eastside dog walker",
"Top dawg dog walker"].each {|text| i << text }
["While you were out pet care", "Eastside dog walker",
"Top dawg dog walker"].each {|text| i << text }
puts i.search(''cat'')
---------------------
So things seem to work as expected.
You might try two things before further investigation:
1. run the script outside of irb: Does it give you the same (wrong) results?
2. gem uninstall ferret and gem install ferret to make sure you are using
solely the latest version of ferret
Cheers,
Jan
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
http://rubyforge.org/pipermail/ferret-talk/attachments/20061010/725d92d0/attachment.html
David Balmain wrote:> On 10/10/06, David Balmain <dbalmain.ml at gmail.com> wrote: >> > It seems I can add any number of items to an index once without a >> > Yep, that was a bug introduced in verion 0.10.10. I''ll get a new gem > up ASAP. You can get the fixed code from subversion right now if you > are in a hurry.David, Thanks for the feedback. Will the gem that includes the fix be 0.10.11? -- Posted via http://www.ruby-forum.com/.
On 10/10/06, Chris Kilmer <christopher.kilmer at biego.com> wrote:> David Balmain wrote: > > On 10/10/06, David Balmain <dbalmain.ml at gmail.com> wrote: > >> > It seems I can add any number of items to an index once without a > >> > > Yep, that was a bug introduced in verion 0.10.10. I''ll get a new gem > > up ASAP. You can get the fixed code from subversion right now if you > > are in a hurry. > > David, > Thanks for the feedback. Will the gem that includes the fix be 0.10.11?Yep. I wanted to get it out today but I still have some testing to do so it''ll have to wait until tomorrow. It''ll definitely be out in the next 24 hours. Dave