[KinoSearch] which field matched a term
peter at peknet.com
Wed Feb 24 09:23:01 PST 2010
Ashley Pond V wrote on 02/24/2010 11:18 AM:
> On Wed, Feb 24, 2010 at 7:15 AM, Peter Karman <peter at peknet.com> wrote:
>> How do I know which field a term matched in?
>> E.g., if I am creating a Highlighter object, I need to pass in a field
>> name, but how do I know which (of potentially dozens) of fields to pick?
> Related note: I'd like to be able to use the highlighter on more than
> one field at a time. I have s simple case where it's title and body
> and it was easy enough to fake the body's matching highlighting on the
> title with a s///. But the highlighter proper is smarter about
> stemming and such and reflects, for sure, the match.
> I know this is not possible now, just putting it out as a wish. :)
You can do that today with Search::Tools::HiLiter, by concatenating the
doc field values into a temporary string. Search::Tools isn't as fast as
KS's Highlighter because it doesn't know in advance the positions and
offsets of the matching term, but the tokenizing and heat map algorithms
are similar (since I stole them from KS...).
Peter Karman . http://peknet.com/ . peter at peknet.com
More information about the kinosearch