lucene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Steven Tamm (JIRA)" <>
Subject [jira] Updated: (LUCENE-509) Performance optimization when retrieving a single field from a document
Date Fri, 03 Mar 2006 01:56:39 GMT
     [ ]

Steven Tamm updated LUCENE-509:

    Attachment: DocField_4.patch

My previous change didn't affect MultiReader, so it was useless for some of our indexes (i.e.
it would work but not be efficient)

I've also included a new accessor function 
String getDocFieldString(int doc, String field)

This allows you direct access to the String associated with the value without needing to instantiate
the Field object.  It's a small optimization, but it save us ~450K/query when we have a lot
of hits.

BTW, someone should create a constructor for Document that takes a number of fields.  That
way you don't create a 10 element Vector array everytime (or have to reallocate the array
4 times if it's 100).  It adds up.

> Performance optimization when retrieving a single field from a document
> -----------------------------------------------------------------------
>          Key: LUCENE-509
>          URL:
>      Project: Lucene - Java
>         Type: Improvement
>   Components: Index
>     Versions: 1.9, 2.0
>     Reporter: Steven Tamm
>  Attachments: DocField.patch, DocField_2.patch, DocField_3.patch, DocField_4.patch
> If you just want to retrieve a single field from a Document, the only way to do it is
to retrieve all the fields from the Document and then search it.  This patch is an optimization
that allows you retrieve a specific field from a document without instantiating a lot of field
and string objects.  This reduces our memory consumption on a per query basis by around around
20% when a lot of documents are returned.
> I've added a lot of comments saying you should only call it if you only ever need one
field.  There's also a unit test.

This message is automatically generated by JIRA.
If you think it was sent incorrectly contact one of the administrators:
For more information on JIRA, see:

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message