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