Hi Dave,
I seem to be having trouble retrieving docs from the index. Am I missing
something obvious? BTW, I am on Windows XP, Ruby 1.8.4.
require ‘rubygems’
require ‘ferret’
p Ferret::VERSION
idx = Ferret::Index::Index.new
idx << {:id => 1, :name => ‘Fred’, :occupation => ‘Toon’}
idx << {:id => 1, :name => ‘Barney’, :occupation => ‘Toon’}
p idx.size
doc = idx[0]
p doc
docs = []
query = ‘*:fred’
idx.search_each(query) { |doc, score| docs << idx[doc] }
p docs.length
p docs.first
docs = []
query = ‘*:toon’
idx.search_each(query) { |doc, score| docs << idx[doc] }
p docs.length
p docs.first
=========
ruby test.rb
“0.10.2”
2
{}
1
{}
2
{}