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”