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