Re: 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”

On 9/5/06, Neville B. [email protected] wrote:

idx << {:id => 2, :name => ‘Barney’, :occupation => ‘Toon’}
idx << {:id => 11, :name => ‘Phantom’, :occupation => ‘Hero’}
p “search each=#{docs.length}”
“search each=10”

Problem still remains though.
I seem to be having trouble getting more than 10 hits from
require ‘ferret’

docs = []

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