Forum: Ferret filter_proc does not work as expected

54a794a2be0873bd8e7d9dd9715b958a?d=identicon&s=25 Thomas Lohmueller (thmeier)
on 2010-01-24 12:03
Hi there

Since some days I'm developing a fulltext-search for our Bugzilla
system. Initial development time was very short but now I'm working on
some details and it does not work as expected. Basically it's two
different problems but most likely related to each other. Attached is a
complete script which illustrates these two problems. Here some
excerpts.

Problem 1:
According to the Ferret API documentation it's valid to scale the score
of results in a filter_proc like this:
 filter_proc = lambda do |doc_id, score, searcher|
   age = searcher[doc_id][:age].to_i
   1.0/age
 end
The filter_proc gets executed but the scale returned is just ignored by
ferret. Why is this?

Problem 2:
Why does this search return "0.0" as score for all docs?
 docs = index.search("+matching +age:2", :filter_proc => simple_proc)
If I remove the filter_proc or the "+" before the age it works. The
simple_proc just returns true for all input. Why do I loose the score
here?

For me it looks like this whole filter_proc stuff is not yet stable or
maybe I don't use it as I should. Any ideas?

Thanks a lot,
Thomas
54a794a2be0873bd8e7d9dd9715b958a?d=identicon&s=25 Thomas Lohmueller (thmeier)
on 2010-01-24 12:04
Attachment: proc_test.rb (1 KB)
sorry, attachment got lost. Next try...

Thomas
This topic is locked and can not be replied to.