No search results using Searcher

I just started using Ferret and I successfully indexed some documents. I
can search this index using the following code:

index = => path)
index.search_each(“something”) do |doc, score|
print “##{doc} #{index[doc][‘url’]} - #{score}”
print “\n”

However, when I try to use Search::Searcher and QueryParser I don’t get
any results. I tried the following code:

queryparser =
searcher =
queryparser.fields = searcher.reader.fields“something”))

I index all my documents as follows:

index = => path, :analyzer =>, false))
index << { :title => title, :url => link, :body => page }

What am I doing wrong?


– Jeffrey G.

On Tue, Oct 31, 2006 at 03:55:07PM +0900, Jeffrey G. wrote:

any results. I tried the following code:
index << { :title => title, :url => link, :body => page }

What am I doing wrong?

Basically you should use the same analyzer to analyze queries as you
used to analyze your content. So constructing your queryparser like
qp = =>,
your searches should work.

However, your regexp for the analyzer looks strange - /./ matches every
single character, including whitespace. So each field’s value would be
indexed as 1-character long terms, which probably is not what you want.

However I don’t know why searching through the Index class worked, I’d
suspect it not to work, too.


webit! Gesellschaft für neue Medien mbH
Dipl.-Wirtschaftsingenieur Jens Krämer [email protected]
Schnorrstraße 76 Tel +49 351 46766 0
D-01069 Dresden Fax +49 351 46766 66