lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Karsten F." <>
Subject Re: Newbie question: using Lucene to index hierarchical information.
Date Mon, 08 Sep 2008 21:26:08 GMT

Hi Leonid,

do you really need the "Complex scenario"?
what kind of query is your use case?

If you really need xpath please look for xml-Databases.

Otherwise you can possible use xtf out of the box, because "indexing of
large structured documents" is exactly the use case for which xtf was
developed (TEI documents, but html is less complex then TEI). 
Again the main idea:
1. Use xml-Elements (with its descendants) to divide the structured document
into sections.
2. index each section as lucene document (field "text") with an extra field
"section type"
3. after all sections of one structured document insert one (terminal)
lucene document with the other metadata of the structured document (e.g.
creation date, title, ..)

the document from point 3 is the representative of the structured document
(and the representative is the unit of retrieval, because the user search
for a document not for a section)
If you search e.g. for 
sectionType:table text:words inside section
you have hits with the lucene documents belonging to the sections.

Possible for your use case it would be enough to insert a stored lucene
field "document key".
In xtf the lucene document-number of each hit is incremented until the
representative is reached.

This is a rough description, but source code of xtf is very readable.

best regards


leonardinius wrote:
> Hi all,
> Thanks a lot for such a quick reply.
> Both scenario sounds very well for me. I would like to do my best and try
> to
> implement any of them (as the proof of the concept) and then incrementally
> improve, retest, investigate and rewrite then :)
> So, from the soap opera to the question part then:
>    - How to implement those things (a and b) on the Lucene and Lucene
>    contribs codebase?
>       - I looked at the
> and
>       didn't like that (too big, to heavy, ready-to use solution instead
> of
>       toolkit). And I didn't understood how to implement "Normal
> scenario" on top
>       of that?
>    - Any suggestions how could I begin implementing these things? Gently
>    moving from "Normal" scenario to some more advanced "Complex"? What
> should I
>    afraid off and possible impacts if any?
> Have anybody tried to use Lucene to analyse things like that? What would
> be
> possible solutions to store indexed data and perform queries on that? If
> Lucene isn't the right tool for this job, maybe some other toolkit would
> more useful(possibly on top of the Lucene)
> Thanks in advance for any suggestions and comments. I would appreciate any
> ideas and directions to look into.
> On Tue, Sep 2, 2008 at 11:46 AM, Karsten F.
> <>wrote:
>> Take a look to the xml-aware search in xtf (
>> ).
>> The idea is to use one lucene-document for each section with only two
>> fields: "text" and "sectionType".
>> But to collect all hits belonging to one hierarchical information (e.g.
>> one
>> html-File) and compress this to one representative hit in lucene.
>> Best regards
>>  Karsten

View this message in context:
Sent from the Lucene - Java Users mailing list archive at

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message