You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@lucene.apache.org by Riccardo Daviddi <rd...@gmail.com> on 2005/08/01 15:37:51 UTC

how to get the snippet?

Hy all,

which is the way to get a snippet of a query?
Does Lucene offer some explicit methods?
If is not so, it's possible to know the position of the matched
keyword in the query into the field of the doc, so that I can take
some words before and after the keyword to create the snippet?
Or there is a smarter way to get the snippet?

thx in advance!
-- 
Riccardo Daviddi
University of Siena - Information Engeneering
rdaviddi@gmail.com

---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org


Re: how to get the snippet?

Posted by Otis Gospodnetic <ot...@yahoo.com>.
Hi,

If you want highlighting like this:
  http://simpy.com/simpy/User.do?username=otis&q=lucene
or like this:
  http://lucenebook.com/search?query=highlighter

Then you'll want to pull Lucene directly from SVN, and look in the
contrib/ directory, where you'll find classes for highlighter.  You can
then build a Jar for the highlighter and use it in your app.  The API
is simple (you can download the code from the Lucene book and see how
it's done).

Otis


--- Riccardo Daviddi <rd...@gmail.com> wrote:

> Hy all,
> 
> which is the way to get a snippet of a query?
> Does Lucene offer some explicit methods?
> If is not so, it's possible to know the position of the matched
> keyword in the query into the field of the doc, so that I can take
> some words before and after the keyword to create the snippet?
> Or there is a smarter way to get the snippet?
> 
> thx in advance!
> -- 
> Riccardo Daviddi
> University of Siena - Information Engeneering
> rdaviddi@gmail.com
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
> For additional commands, e-mail: java-user-help@lucene.apache.org
> 
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org