The included test script turned up the following anomolies (run
against Ferret 0.10.3, but had same problems with 0.10.2):
- When the content word is not in the index the inclusion of a
wildcard file term causes search_each to throw a segmentation
fault.
$ ./test.rb zzz file:.txt
query: +content:zzz +file:.txt
./test.rb:28: [BUG] Segmentation fault
ruby 1.8.4 (2005-12-24) [i486-linux]
Aborted
- When the file query term is file:* wildcard the parser
translates it to +* instead of +file:*
$ ./test.rb one file:*
query: +content:one +*
file: f1.txt
Am I missing something here?
Cheers Stuart
Stuart R.
-----------BEGIN SCRIPT----------------
#!/usr/bin/env ruby
require ‘rubygems’
require ‘ferret’
include Ferret
path = ‘/tmp/test_index’
index = Index::IndexWriter.new(:create => true, :path => path)
index.field_infos.add_field(:file, :store => :yes, :index =>
:untokenized)
index.field_infos.add_field(:content, :store => :no, :index => :yes)
index << {:content => ‘one’, :file => ‘f1.txt’}
index << {:content => ‘two’, :file => ‘f2.txt’}
index << {:content => ‘three’, :file => ‘f3.txt’}
index << {:content => ‘four’, :file => ‘f4.txt’}
index << {:content => ‘five’, :file => ‘f5.txt’}
index.optimize
index.close
query_parser = QueryParser.new({:default_field => :content,
:or_default => false,
})
query = query_parser.parse(ARGV.join(’ '))
puts “query: #{query}”
searcher = Search::Searcher.new(path)
searcher.search_each(query) do |doc, score|
puts “file: #{searcher[doc][:file]}”
end
-------------END SCRIPT----------------