lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Michael McCandless <>
Subject Re: reusing Document with multiple fields in lucene 2.3
Date Tue, 02 Sep 2008 08:26:59 GMT
Maybe the complexity caused by reuse in this case (a pool of Field  
instances) may not be offset by the performance gains of avoiding GC?   
You could code up a quick test and see what performance gains it gives  

Reuse works very well when your documents are extremely regular.


Juyal wrote:

> Hello all!
> I have a document structure such that each document can have  
> multiple and
> variable number of fields of a given name. For example:
> - Document-1 has two fields with the name "fld1" and three fields  
> with the
> name "fld2";
> - Document-2 has five fields with the name "fld1" and one field with  
> the
> name "fld2".
> If a document has a fixed number of fields then it's easy to reuse the
> field instances by setting them to different values before writing  
> the doc,
> but I can't think of any way in which I can reuse the document or  
> field
> instances in this case (where the number of fields varies from  
> document to
> document). One possibility is to maintain a pool of fields, create a  
> new
> instance for each document and add the already-existing fields to  
> the new
> doc after setting them to an appropriate value. But this would require
> significant additions to the code.
> Has anyone else faced such a situation? I'd be glad if someone could  
> give
> any pointers for this situation! Thanks in anticipation!
> - Gunjan
> -- 
> View this message in context:
> Sent from the Lucene - Java Users mailing list archive at
> ---------------------------------------------------------------------
> To unsubscribe, e-mail:
> For additional commands, e-mail:

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

View raw message