
marvin at rectangular
Apr 24, 2007, 6:28 PM
Post #2 of 2
(551 views)
Permalink
|
|
Search in one field, yet highlights across all fields
[In reply to]
|
|
On Apr 24, 2007, at 3:31 PM, Edward Betts wrote: > I search > for a string + bool_field=1 and I get the hits I want, but the > highlighter doesn't care which field I was looking for a term in. All > the 1s in my body field get highlighted. He is a short code sample, Thank you for the report and the sample. Code-wise, this was easy to fix: only highlight terms whose fields match. I'm pretty sure that's the behavior we'll want generally. The change has gone in as revision 2361, which should be safe for use. svn co -r 2361 http://www.rectangular.com/svn/kinosearch/trunk ks Please note that the Highlighter API changed as of this morning (docs at <http://xrl.us/vv4v>). The constructor no longer takes any arguments; you now control highlighting via the new method add_spec (), which allows you to apply different settings to different fields, or even generate multiple excerpts from the same field. my $highlighter = KinoSearch::Highlight::Highlighter->new; $highlighter->add_spec( field => 'content', # required excerpt_length => 150, # default: 200 formatter => $formatter, # default: SimpleHTMLFormatter encoder => $encoder, # default: SimpleHTMLEncoder name => 'blurb' # default: value of field param ); $hits->create_excerpts( highlighter => $highlighter ); Cheers, Marvin Humphrey Rectangular Research http://www.rectangular.com/
|