On 9/5/06, Neville Burnell <[EMAIL PROTECTED]> 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: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED] On Behalf Of Neville Burnell
> Sent: Tuesday, 5 September 2006 5:08 PM
> To: [email protected]
> 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: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED] On Behalf Of Neville Burnell
> Sent: Tuesday, 5 September 2006 5:00 PM
> To: [email protected]
> 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

Hi 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
_______________________________________________
Ferret-talk mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/ferret-talk

Reply via email to