The following script creates a search index and then searches it. I get
no results? Where am I going wrong?
Thanks.
-----------BEGIN SCRIPT----------------
require 'rubygems'
require 'ferret'
include Ferret
path = '/tmp/myindex'
field_infos = Ferret::Index::FieldInfos.new()
field_infos.add_field(:name, :store => :yes, :index => :yes)
field_infos.create_index(path)
index = Index::Index.new(:path => path, :field_infos => field_infos,
:analyzer => Analysis::AsciiStandardAnalyzer.new)
index << {:name => "Joe"}
index << {:name => "Sandy"}
index << {:name => "Billy"}
index << {:name => "Lona"}
index << {:name => "Frank"}
index.optimize
query = Search::TermQuery.new(:name, "Joe")
index.search_each(query, {:limit => :all}) do |doc, score|
puts 'i am here to just drink some hot chocolate.'
puts index[doc]["name"]
end
-------------END SCRIPT----------------
--
Posted via http://www.ruby-forum.com/.
_______________________________________________
Ferret-talk mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/ferret-talk