lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Erick Erickson" <erickerick...@gmail.com>
Subject Re: How to get list of all terms from given doc id?
Date Mon, 16 Apr 2007 11:33:14 GMT
You can still recover all the terms. However,
depending upon whether you've stored the field values, the reconstruction
may or may not be completely accurate.

Luke has to do something like this because you can use the
"Reconstruct & Edit" button, you can download that source and see
how it's done there.

Conceptually, you would do something like
Document.getFields. For each field, enumerate all
the terms in the index using TermEnum (use a value of
"" to enumerate all the terms). For each such term, use
a TermDocs to skipTo the id of the doc you're working
on. Use a TermPositions object to find the relative offsets
of each term.

Eventually, you'll have several lists of all the terms and their
positions that you'll have to merge.

This is a complex and time-consuming process, though. Why do
you need to do this anyway?

Erick

On 4/16/07, Bhavin Pandya <bhavinp@rediff.co.in> wrote:
>
> Hi guys,
>
> In my existing index, i have not stored my index with TermVector.YES.
> is there any way to fetch all the terms from the given document id.
>
> Thanks.
> Bhavin pandya

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message