lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Vikas" <vikas.kheng...@unnat-e.com>
Subject UnExpected result for: indexReader.termDocs()
Date Mon, 09 Jul 2007 07:11:57 GMT
Hi Friends,

Before indexing somthing I want to check whether this term is already exist in index / NOT.[i.e.
primary key kind of thing].

When I am trying to get docs with indexReader.termDocs(term); it is not returning expected
results.
I put "TermDocs" object in while loop to print document number where I found this term; but
it is always printing "0" and going in infinite loop.
Where the term, I am searching is exists in index and can get it though "indexReader.terms(term);"

Here is the code -->

Term term = new Term( SomeDocument.KEY, value);
TermDocs termDocs = indexReader.termDocs(term);
while(termDocs !=null)
{
   System.out.println("Document num:"+termDocs.doc());
   termDocs.next();
}

This is going in infinite loop and printing "Document num:0" always.
Can some one will give me information on this?

With best regards

From
Vikas R. Khengare

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