Span Queries also return positional information

On Dec 11, 2006, at 12:12 PM, Steven Rowe wrote:

abdul aleem wrote:
How to actually retrieve the content of search,

Most of the examples in Lucene in Action
Searcher gives the results found in number of
documents

but i coudln't find an API to retrieve the line or
paragraph where the search is matched

Hi Abdul,

I don't know what your log files look like -- how have you defined your
Lucene document?  The document is the only level of granularity
available for returning hits in Lucene.

Something you should look at, though, is Mark Harwood's Highlighter
package, which is part of the Lucene Sandbox. This package can be used
to break documents into fragments, to score those fragments based on a
supplied query, and then to highlight the terms from the query.  Below
is a link to the API docs:

http://lucene.apache.org/java/docs/api/org/apache/lucene/search/ highlight/package-summary.html

You can find a description of using this package in "Lucene in Action",
in Section 8.7.

The Highlighter distribution .jar is packed inside of lucene-2.0.0.zip,
available from Apache mirrors:

http://www.apache.org/dyn/closer.cgi/lucene/java/

Also, the JUnit tests are a good place to see how to use this package:

https://svn.apache.org/repos/asf/lucene/java/trunk/contrib/ highlighter/src/test/org/apache/lucene/search/highlight/ HighlighterTest.java

Hope it helps,
Steve

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


------------------------------------------------------
Grant Ingersoll
http://www.grantingersoll.com/



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to