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 Olivier Catteau <oc...@hotmail.com> on 2004/06/24 17:10:25 UTC

Rebuild a part of an indexed document

Hi !

I would like to rebuild a part of a document that I have indexed with Lucene without reopen it and parsing it again.

In fact, I would like to reconstitute the parts of the documents which corresponds to a search. 

Here is an example of what I would like to obtain :
String myDocumentIndexed = 
"Of all the amazing tales told about the Titanic, there is one little story I always find fascinating even though it tells us absolutely nothing about the details of the TRAGIC sinking on that cold night in April 1912."
+ "It is not the fact that the great liner was designed and had the space to carry 48 lifeboats but only 16 were actually included to fulfil the letter of the law. It was not the fact that in spite of ice WARNINGS the ship's speed was not reduced. If it had been, then fewer watertight compartments would have been flooded, and the ship would have remained afloat much longer, and possibly been salvaged.";

I release a search on "TRAGIC WARNINGS", I get a Hits instance containing my document (path + indexed content).

On this resulting document, I would like to have a "summary" corresponding to my request "TRAGIC WARNINGS" such as this (or such as Google) :
"... nothing about the details of the TRAGIC sinking on that cold night .. the fact that in spite of ice WARNINGS the ship's speed was not reduced ..."

And I would like to obtain this summary without reopen my document (big PDF) and without parsing it again.

For the moment, I can have the "summary" but only if I parse again my PDF document (it takes about 60s per document, it's to uch).

Is it possible to rebuild a part of an indexed document ? And, if it is, how to do this ?

Thanks a lot !

Re: Rebuild a part of an indexed document

Posted by Andrzej Bialecki <ab...@getopt.org>.
Olivier Catteau wrote:

> Hi !
> 
> I would like to rebuild a part of a document that I have indexed with Lucene without reopen it and parsing it again.
> 
> In fact, I would like to reconstitute the parts of the documents which corresponds to a search. 

What you describe is also known as "snippets". In all implementations 
known to me search engines use cached copies of the plain text content 
in order to produce snippets - there is no re-parsing needed, but 
storage requirements are higher.

You can do it in Lucene by storing the plain text content in a stored 
field, and then using the highlighter package from the sandbox to 
produce snippets.

-- 
Best regards,
Andrzej Bialecki

-------------------------------------------------
Software Architect, System Integration Specialist
CEN/ISSS EC Workshop, ECIMF project chair
EU FP6 E-Commerce Expert/Evaluator
-------------------------------------------------
FreeBSD developer (http://www.freebsd.org)


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