Neville Burnell
2006-Sep-05 07:00 UTC
[Ferret-talk] Ferret 0.10.2 - Index#search_each() and :num_docs
Hi,
I seem to be having trouble getting more than 10 hits from
Index#search_each since upgrading to 0.10.2 (ie, this was working in
0.9.4). Maybe a bug, as the #search_each doesn''t seem to use the
options
parameter any more ?
Thanks,
Neville
==========================================
require ''rubygems''
require ''ferret''
p Ferret::VERSION
idx = Ferret::Index::Index.new
idx << {:id => 1, :name => ''Fred'', :occupation
=> ''Toon''}
idx << {:id => 2, :name => ''Barney'', :occupation
=> ''Toon''}
idx << {:id => 3, :name => ''Wilma'', :occupation
=> ''Toon''}
idx << {:id => 4, :name => ''Betty'', :occupation
=> ''Toon''}
idx << {:id => 5, :name => ''Pebbles'', :occupation
=> ''Toon''}
idx << {:id => 6, :name => ''Superman'', :occupation
=> ''Hero''}
idx << {:id => 7, :name => ''Batman'', :occupation
=> ''Hero''}
idx << {:id => 8, :name => ''Spiderman'',
:occupation => ''Hero''}
idx << {:id => 9, :name => ''Green Lantern'',
:occupation => ''Hero''}
idx << {:id => 10, :name => ''Dr Strange'',
:occupation => ''Hero''}
idx << {:id => 11, :name => ''Phantom'', :occupation
=> ''Hero''}
p idx.size
docs = []
query = ''occupation:(hero toon)''
idx.search_each(query, :doc_num => idx.size) { |doc, score| docs <<
idx[doc] }
p query
p docs.length
============
ruby idx.rb
"0.10.2"
11
"occupation:(hero toon)"
10
Neville Burnell
2006-Sep-05 07:08 UTC
[Ferret-talk] Ferret 0.10.2 - Index#search_each() and :num_docs
Doh, replace:
idx.search_each(query, :doc_num => idx.size) { |doc, score| docs <<
idx[doc] }
With:
idx.search_each(query, :num_docs => idx.size) { |doc, score| docs <<
idx[doc] }
Problem still remains though.
-----Original Message-----
From: ferret-talk-bounces at rubyforge.org
[mailto:ferret-talk-bounces at rubyforge.org] On Behalf Of Neville Burnell
Sent: Tuesday, 5 September 2006 5:00 PM
To: ferret-talk at rubyforge.org
Subject: [Ferret-talk] Ferret 0.10.2 - Index#search_each() and :num_docs
Hi,
I seem to be having trouble getting more than 10 hits from
Index#search_each since upgrading to 0.10.2 (ie, this was working in
0.9.4). Maybe a bug, as the #search_each doesn''t seem to use the
options
parameter any more ?
Thanks,
Neville
==========================================
require ''rubygems''
require ''ferret''
p Ferret::VERSION
idx = Ferret::Index::Index.new
idx << {:id => 1, :name => ''Fred'', :occupation
=> ''Toon''} idx << {:id =>
2, :name => ''Barney'', :occupation =>
''Toon''} idx << {:id => 3, :name =>
''Wilma'', :occupation => ''Toon''} idx
<< {:id => 4, :name => ''Betty'',
:occupation => ''Toon''} idx << {:id => 5, :name
=> ''Pebbles'', :occupation
=> ''Toon''}
idx << {:id => 6, :name => ''Superman'', :occupation
=> ''Hero''} idx <<
{:id => 7, :name => ''Batman'', :occupation =>
''Hero''} idx << {:id => 8,
:name => ''Spiderman'', :occupation =>
''Hero''} idx << {:id => 9, :name =>
''Green Lantern'', :occupation => ''Hero''}
idx << {:id => 10, :name => ''Dr
Strange'', :occupation => ''Hero''}
idx << {:id => 11, :name => ''Phantom'', :occupation
=> ''Hero''}
p idx.size
docs = []
query = ''occupation:(hero toon)''
idx.search_each(query, :doc_num => idx.size) { |doc, score| docs <<
idx[doc] }
p query
p docs.length
============
ruby idx.rb
"0.10.2"
11
"occupation:(hero toon)"
10
_______________________________________________
Ferret-talk mailing list
Ferret-talk at rubyforge.org
http://rubyforge.org/mailman/listinfo/ferret-talk
Neville Burnell
2006-Sep-05 07:21 UTC
[Ferret-talk] Ferret 0.10.2 - Index#search_each() and :num_docs
And the problem doesn''t occur in Index#search, ie:
require ''rubygems''
require ''ferret''
p Ferret::VERSION
idx = Ferret::Index::Index.new
idx << {:id => 1, :name => ''Fred'',
:occupation => ''Toon''}
idx << {:id => 2, :name => ''Barney'',
:occupation => ''Toon''}
idx << {:id => 3, :name => ''Wilma'',
:occupation => ''Toon''}
idx << {:id => 4, :name => ''Betty'',
:occupation => ''Toon''}
idx << {:id => 5, :name => ''Pebbles'',
:occupation => ''Toon''}
idx << {:id => 6, :name => ''Superman'',
:occupation => ''Hero''}
idx << {:id => 7, :name => ''Batman'',
:occupation => ''Hero''}
idx << {:id => 8, :name => ''Spiderman'',
:occupation => ''Hero''}
idx << {:id => 9, :name => ''Green Lantern'',
:occupation => ''Hero''}
idx << {:id => 10, :name => ''Dr Strange'',
:occupation => ''Hero''}
idx << {:id => 11, :name => ''Phantom'',
:occupation => ''Hero''}
p idx.size
docs = []
query = ''occupation:(hero toon)''
p "query=#{query}"
options = {:num_docs => idx.size}
idx.search_each(query, options) { |doc, score| docs << idx[doc] }
p "search each=#{docs.length}"
a = idx.search(query, options)
p "search=#{a.total_hits}"
============
ruby idx.rb
"0.10.2"
11
"query=occupation:(hero toon)"
"search each=10"
"search=11"
-----Original Message-----
From: ferret-talk-bounces at rubyforge.org
[mailto:ferret-talk-bounces at rubyforge.org] On Behalf Of Neville Burnell
Sent: Tuesday, 5 September 2006 5:08 PM
To: ferret-talk at rubyforge.org
Subject: Re: [Ferret-talk] Ferret 0.10.2 - Index#search_each() and
:num_docs
Doh, replace:
idx.search_each(query, :doc_num => idx.size) { |doc, score| docs <<
idx[doc] }
With:
idx.search_each(query, :num_docs => idx.size) { |doc, score| docs <<
idx[doc] }
Problem still remains though.
-----Original Message-----
From: ferret-talk-bounces at rubyforge.org
[mailto:ferret-talk-bounces at rubyforge.org] On Behalf Of Neville Burnell
Sent: Tuesday, 5 September 2006 5:00 PM
To: ferret-talk at rubyforge.org
Subject: [Ferret-talk] Ferret 0.10.2 - Index#search_each() and :num_docs
Hi,
I seem to be having trouble getting more than 10 hits from
Index#search_each since upgrading to 0.10.2 (ie, this was working in
0.9.4). Maybe a bug, as the #search_each doesn''t seem to use the
options
parameter any more ?
Thanks,
Neville
==========================================
require ''rubygems''
require ''ferret''
p Ferret::VERSION
idx = Ferret::Index::Index.new
idx << {:id => 1, :name => ''Fred'', :occupation
=> ''Toon''} idx << {:id =>
2, :name => ''Barney'', :occupation =>
''Toon''} idx << {:id => 3, :name =>
''Wilma'', :occupation => ''Toon''} idx
<< {:id => 4, :name => ''Betty'',
:occupation => ''Toon''} idx << {:id => 5, :name
=> ''Pebbles'', :occupation
=> ''Toon''}
idx << {:id => 6, :name => ''Superman'', :occupation
=> ''Hero''} idx <<
{:id => 7, :name => ''Batman'', :occupation =>
''Hero''} idx << {:id => 8,
:name => ''Spiderman'', :occupation =>
''Hero''} idx << {:id => 9, :name =>
''Green Lantern'', :occupation => ''Hero''}
idx << {:id => 10, :name => ''Dr
Strange'', :occupation => ''Hero''}
idx << {:id => 11, :name => ''Phantom'', :occupation
=> ''Hero''}
p idx.size
docs = []
query = ''occupation:(hero toon)''
idx.search_each(query, :doc_num => idx.size) { |doc, score| docs <<
idx[doc] }
p query
p docs.length
============
ruby idx.rb
"0.10.2"
11
"occupation:(hero toon)"
10
_______________________________________________
Ferret-talk mailing list
Ferret-talk at rubyforge.org
http://rubyforge.org/mailman/listinfo/ferret-talk
_______________________________________________
Ferret-talk mailing list
Ferret-talk at rubyforge.org
http://rubyforge.org/mailman/listinfo/ferret-talk
David Balmain
2006-Sep-05 08:00 UTC
[Ferret-talk] Ferret 0.10.2 - Index#search_each() and :num_docs
On 9/5/06, Neville Burnell <Neville.Burnell at bmsoft.com.au> wrote:> And the problem doesn''t occur in Index#search, ie: > > require ''rubygems'' > require ''ferret'' > > p Ferret::VERSION > > idx = Ferret::Index::Index.new > > idx << {:id => 1, :name => ''Fred'', :occupation => ''Toon''} > idx << {:id => 2, :name => ''Barney'', :occupation => ''Toon''} > idx << {:id => 3, :name => ''Wilma'', :occupation => ''Toon''} > idx << {:id => 4, :name => ''Betty'', :occupation => ''Toon''} > idx << {:id => 5, :name => ''Pebbles'', :occupation => ''Toon''} > > idx << {:id => 6, :name => ''Superman'', :occupation => ''Hero''} > idx << {:id => 7, :name => ''Batman'', :occupation => ''Hero''} > idx << {:id => 8, :name => ''Spiderman'', :occupation => ''Hero''} > idx << {:id => 9, :name => ''Green Lantern'', :occupation => ''Hero''} > idx << {:id => 10, :name => ''Dr Strange'', :occupation => ''Hero''} > > idx << {:id => 11, :name => ''Phantom'', :occupation => ''Hero''} > > p idx.size > > docs = [] > query = ''occupation:(hero toon)'' > p "query=#{query}" > options = {:num_docs => idx.size} > > > idx.search_each(query, options) { |doc, score| docs << idx[doc] } > p "search each=#{docs.length}" > > a = idx.search(query, options) > p "search=#{a.total_hits}" > > ============> > ruby idx.rb > "0.10.2" > 11 > "query=occupation:(hero toon)" > "search each=10" > "search=11" > > > -----Original Message----- > From: ferret-talk-bounces at rubyforge.org > [mailto:ferret-talk-bounces at rubyforge.org] On Behalf Of Neville Burnell > Sent: Tuesday, 5 September 2006 5:08 PM > To: ferret-talk at rubyforge.org > Subject: Re: [Ferret-talk] Ferret 0.10.2 - Index#search_each() and > :num_docs > > Doh, replace: > > idx.search_each(query, :doc_num => idx.size) { |doc, score| docs << > idx[doc] } > > With: > > idx.search_each(query, :num_docs => idx.size) { |doc, score| docs << > idx[doc] } > > Problem still remains though. > > -----Original Message----- > From: ferret-talk-bounces at rubyforge.org > [mailto:ferret-talk-bounces at rubyforge.org] On Behalf Of Neville Burnell > Sent: Tuesday, 5 September 2006 5:00 PM > To: ferret-talk at rubyforge.org > Subject: [Ferret-talk] Ferret 0.10.2 - Index#search_each() and :num_docs > > Hi, > > I seem to be having trouble getting more than 10 hits from > Index#search_each since upgrading to 0.10.2 (ie, this was working in > 0.9.4). Maybe a bug, as the #search_each doesn''t seem to use the options > parameter any more ? > > Thanks, > > Neville > ==========================================> > require ''rubygems'' > require ''ferret'' > > p Ferret::VERSION > > idx = Ferret::Index::Index.new > > idx << {:id => 1, :name => ''Fred'', :occupation => ''Toon''} idx << {:id => > 2, :name => ''Barney'', :occupation => ''Toon''} idx << {:id => 3, :name => > ''Wilma'', :occupation => ''Toon''} idx << {:id => 4, :name => ''Betty'', > :occupation => ''Toon''} idx << {:id => 5, :name => ''Pebbles'', :occupation > => ''Toon''} > > idx << {:id => 6, :name => ''Superman'', :occupation => ''Hero''} idx << > {:id => 7, :name => ''Batman'', :occupation => ''Hero''} idx << {:id => 8, > :name => ''Spiderman'', :occupation => ''Hero''} idx << {:id => 9, :name => > ''Green Lantern'', :occupation => ''Hero''} idx << {:id => 10, :name => ''Dr > Strange'', :occupation => ''Hero''} > > idx << {:id => 11, :name => ''Phantom'', :occupation => ''Hero''} > > p idx.size > > docs = [] > query = ''occupation:(hero toon)'' > idx.search_each(query, :doc_num => idx.size) { |doc, score| docs << > idx[doc] } > > p query > p docs.length > > > ============> > > ruby idx.rb > "0.10.2" > 11 > "occupation:(hero toon)" > 10Hi Neville, Some of the parameter names have changed in version 0.10.0. :num_docs has become :limit and :first_doc has become :offset. Unfortunately I neglected to update the documentation. I''ve remedied that and the fix will be out in the next release. Cheers, Dave
Neville Burnell
2006-Sep-05 10:33 UTC
[Ferret-talk] Ferret 0.10.2 - Index#search_each() and :num_docs
Hi Dave,> Some of the parameter names have changed in version 0.10.0. > :num_docs has become :limit and :first_doc has become :offset. > Unfortunately I neglected to update the documentation. I''ve > remedied that and the fix will be out in the next release.Cool, thanks Neville