lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Michael McCandless <luc...@mikemccandless.com>
Subject Re: TopDocs - Get all docs?
Date Wed, 17 Dec 2008 14:06:00 GMT

It might be faster to use FieldCache.DEFAULT.getStrings(reader,  
"empid"), assuming empid is indexed but is not analyzed (or always  
analyzes to one token).

Though, that then persists the resulting array in the FieldCache.

We are wanting to create "column stride fields" (LUCENE-1231) to make  
accessing a single field's value for all docs fast... but it'll be  
some time before that's in.

Mike

Donna L Gresh wrote:

> 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
>>


---------------------------------------------------------------------
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