Segmentation fault in Search::Searcher#highlight

I’m using ferret 0.10.14 in Linux Fedora 3.
When I do highlight with Index::Index#highlight, it works well.
But, doing the same test with Searcher#highlight,
[BUG] Segmentation fault occurred.

Here’s my test code.

require ‘rubygems’
require ‘ferret’
include Ferret::Search

#searcher = Ferret::Index::Index.new(:path => ‘./index’) # works
searcher = Searcher.new("./index") # not works! segmentation fault!!

query = TermQuery.new(:content, ARGV[0])

searcher.search_each(query) do |doc_id, score|
puts “Document #{doc_id} found with a score of #{score}”
puts searcher.highlight(query, doc_id, :field => :content)
end

Do I have some wrong implementation? Help me…

sjoonk wrote:

I’m using ferret 0.10.14 in Linux Fedora 3.
When I do highlight with Index::Index#highlight, it works well.
But, doing the same test with Searcher#highlight,
[BUG] Segmentation fault occurred.

Here’s my test code.

require ‘rubygems’
require ‘ferret’
include Ferret::Search

#searcher = Ferret::Index::Index.new(:path => ‘./index’) # works
searcher = Searcher.new("./index") # not works! segmentation fault!!

query = TermQuery.new(:content, ARGV[0])

searcher.search_each(query) do |doc_id, score|
puts “Document #{doc_id} found with a score of #{score}”
puts searcher.highlight(query, doc_id, :field => :content)
end

Do I have some wrong implementation? Help me…

I found a solution(a trick). When I put the 4th parameter to
Searcher#highlight method, it works! I don’t know why. Maybe it’s a
bug… I think.
Anyway, here’s my solution.

puts searcher.highlight(query, doc_id, :content, {})

Enjoy Ferret!