lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Donna L Gresh <gr...@us.ibm.com>
Subject Re: TopDocs - Get all docs?
Date Wed, 17 Dec 2008 13:25:43 GMT
Thanks-
Yes in my use-case there are never any deleted documents when the search 
is run- (deletion takes place in a pre-processing stage)

Toke Eskildsen <te@statsbiblioteket.dk> wrote on 12/17/2008 08:16:31 AM:

> On Mon, 2008-12-08 at 15:17 +0100, Donna L Gresh wrote:
> >         public Vector getIndexIds() throws Exception {
> > 
> >                 Vector vec = new Vector();
> >                 IndexReader ireader = IndexReader.open(directoryName);
> >                 int numdocs = ireader.numDocs();
> >                 for (int i=0; i<numdocs; i++) {
> >                         Document doc = ireader.document(i);
> 
> It's probably best to perform a check for ireader.isDeleted(i) here,
> unless the index never contains deleted documents.
> 
> >                         Field field = doc.getField("empid");
> >                         if (field==null) {
> >                                 continue;
> >                         }
> >                         String contents = field.stringValue();
> >                         vec.add(contents);
> >                 }
> >                 return vec;
> >         }
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
> For additional commands, e-mail: java-user-help@lucene.apache.org
> 

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