You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@lucene.apache.org by John Wang <jo...@gmail.com> on 2005/01/07 04:49:42 UTC

reading fields selectively

Hi:

   Is there some way to read only 1 field value from an index given a docID?

   From the current API, in order to get a field from given a docID, I
would call:
 
    IndexSearcher.document(docID)

     which in turn reads in all fields from the disk.

   Here is my problem:

           After the search, I have a set of docIDs. For each
document, I have a unique string identifier. At this point I only need
these identifiers but with the above API, I am forced to read the
entire row of fields for each document in the search result, which in
my case can be very large.

           Is there an alternative?

I am thinking more on the lines of a call:

           Field[] getFields(int docID,String fieldName);

Thanks

-John

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


Re: reading fields selectively

Posted by Otis Gospodnetic <ot...@yahoo.com>.
Hi John,

There is no API for this, but I recall somebody talking about adding
support for this a few months back.  I even think that somebody might
have contributed a patch for this.  I am not certain about this, but
check the patch queue (link on Lucene site).  If there is a patch
there, even if the patch no longer applies cleanly, you'll be able to
borrow the code for your own patch.  Also note that the CVS version has
support for field compression, which should help with performance if
you are working with large fields.

Otis

--- John Wang <jo...@gmail.com> wrote:

> Hi:
> 
>    Is there some way to read only 1 field value from an index given a
> docID?
> 
>    From the current API, in order to get a field from given a docID,
> I
> would call:
>  
>     IndexSearcher.document(docID)
> 
>      which in turn reads in all fields from the disk.
> 
>    Here is my problem:
> 
>            After the search, I have a set of docIDs. For each
> document, I have a unique string identifier. At this point I only
> need
> these identifiers but with the above API, I am forced to read the
> entire row of fields for each document in the search result, which in
> my case can be very large.
> 
>            Is there an alternative?
> 
> I am thinking more on the lines of a call:
> 
>            Field[] getFields(int docID,String fieldName);
> 
> Thanks
> 
> -John
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: lucene-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: lucene-user-help@jakarta.apache.org
> 
> 


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