lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Chris Hostetter <hossman_luc...@fucit.org>
Subject Re: Document ids in Lucene index
Date Mon, 14 Apr 2008 22:12:16 GMT

: - check maxDoc()
: - iterate from 0 to maxDoc() and process doc if it is not deleted

For the record: that is exactly what MatchAllDocsQuery does ... except 
that you have an off by one error (maxDoc returns 1 more then the 
largest possible document number).

Even if you don't want the Query API, just use MatchAllDocs to handle the 
details for you and save yourself some code...

  Scorer allDocs = (new MatchAllDocs()).weight(searcher).scorer(reader);
  while (allDocs.next()) {
    int doc = allDocs.doc()
       ...do stuff..
  }



-Hoss


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


Mime
View raw message