tags:

views:

62

answers:

1

I would like to know how can I get the matching string results by performing search on a Lucene index ?

I have tried to install the Perl module Lucene::Search::Highlight and failed over and over again. Is there another I can get the relevant fragments of text that Lucene "thinks" they relevant for my search phrase?

A: 

Two possible ways to do what you ask for, dependent on what you want:

  1. See what strings matched for debugging purposes: Java Lucene has explain() for this purpose. As Plucene should be similar, I suggest you look for explain() in the source code, as I failed to find it in the documentation.
  2. Display matched strings to the user: Use the highlighter, as you tried to do. I suggest you post code with specific problems to SO and probably someone will be able to help.
Yuval F