Hi there,
Is highlighting for range queries supposed to work ?
It doesn’t work here.
here is an non-working example: (highlighting works when q=“test:2007*”)
require ‘ferret’
include Ferret
index = Index::Index.new()
#index.field_infos.add_field(:test, :store => :yes, :index =>
:untokenized)
i=1
for a in [ “20070505”, “20071230”, “20060920”, “20081111” ]
index << {:id => i, :test => a}
i+=1
end
for q in [ ‘test:( >= 20070101)’, ‘test:2007*’,
Ferret::Search::RangeQuery.new(:test, :>= => “20070101”) ]
index.search_each(q) do |id, score|
puts “Document #{index[id][:test]} found with a score of #{score}”
highlights = index.highlight(q, id, :field => :test, :pre_tag =>
“\033[36m”, :post_tag => “\033[m”)
puts highlights
end
puts “------”
end