I am having the same problem.
I cannot figure out how to get filters working using options for
Index::Index search.
http://ferret.davebalmain.com/api/classes/Ferret/Index/Index.html#M000022
For example suppose I am trying to run the following query:
Search for "frog" filtering on color=green or color=red
----------------------
I have tried the following with no success:
## Search for "frog"
t = TermQuery.new(:content, "frog")
b = BooleanQuery.new(t,:should)
## Filter on color=(green OR red)
t1 = TermQuery.new(:color,"red")
t2 = TermQuery.new(:color,"green")
b1 = BooleanQuery.new
b1.add_query(t1,:should)
b1.add_query(t2,:should)
b2 = BooleanQuery.new
b2.add_query(b1,:must)
## merge query and filter
b.add_query(FilterQuery.new(b2),:must)
## setup index
index = Index::Index.new(:path => @index_dir)
## search
@result = index.search(b, options={})
----------------------
This last line causes the following error:
ruby(534,0xa06fdfa0) malloc: *** error for object 0x4c1a21: Non-
aligned pointer being freed
*** set a breakpoint in malloc_error_break to debug
ruby(534,0xa06fdfa0) malloc: *** error for object 0x7038: Non-aligned
pointer being freed
*** set a breakpoint in malloc_error_break to debug
label:president content:president +
limit10offset0
--- Entering query execution ---
/Library/Ruby/Gems/1.8/gems/ferret-0.11.6/lib/ferret/index.rb:768:
[BUG] Segmentation fault
ruby 1.8.6 (2007-09-24) [universal-darwin9.0]
Abort trap
----------------------
???
Benjamin
On Feb 28, 2008, at 4:23 AM, Bira wrote:
First, I'd like to thank you all for your patience and help on the
"Document Scores" issue :).
Now, I have a bit of a "noob" question... Is there a way to apply
multiple filters to the same query? For example, I want to apply both
a RangeFilter and a QueryFilter, but from what I've seen in the API
docs, the :filter parameter that can be passed to the Searcher accepts
only one filter. It does mention the possibility of applying filters
to each other, but provides no examples.
Is this possible? How can it be done?
--
Bira
http://compexplicita.wordpress.com
http://compexplicita.tumblr.com
_______________________________________________
Ferret-talk mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/ferret-talk
_______________________________________________
Ferret-talk mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/ferret-talk