Forum: Ferret filter_proc does not work as expected

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
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

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
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 ="+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

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,
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...

This topic is locked and can not be replied to.