Hi.
I want to learn more about ferret. So I downloaded ferret-0.10.14 and
write a simple test script
Only query = TermQuery.new(:content, ‘program’) gives result.
If I change ‘program’ with ‘Good’ or ‘Extra’ -> no result
and searching on (:title, ‘Ruby’) -> no result
Strange, Strange
Here is the script
require ‘rubygems’
require ‘ferret’
include Ferret
include Ferret::Search
include Ferret::Index
index = Index.new(:path => ‘./index’)
index << {:location => ‘here’,
:title => 'Programming Ruby',
:content => 'Good excellent program'
}
index << {:location => ‘local’,
:title => 'Programming Rubyist',
:content => 'Extra ordinary program'
}
index.close()
searcher = Searcher.new(’./index’)
query = TermQuery.new(:content, ‘Good’)
searcher.search_each(query) do |id, score|
doc = searcher[id]
puts “Document #{id} found with a score of #{score}”
puts doc[:content]
end