You are viewing a plain text version of this content. The canonical link for it is here.
Posted to solr-dev@lucene.apache.org by Chris Hostetter <ho...@fucit.org> on 2007/06/27 20:37:31 UTC
Re: svn commit: r551060 - /lucene/solr/trunk/src/java/org/apache/solr/update/DocumentBuilder.java
: check for null copyField source, delay some allocations
i understanding delaying the allocation of missingFields, but why only a
size of 1 once it is allocated? (is this just an assumption thta
typically only a few fieldswill be missing? would it make sense to just
switch to a LinkedLIst since missingFields is only ever used for
iteration?)
: - List<String> missingFields = new ArrayList<String>( schema.getRequiredFields().size() );
: + List<String> missingFields = null;
: for (SchemaField field : schema.getRequiredFields()) {
: if (doc.getField(field.getName() ) == null) {
: if (field.getDefaultValue() != null) {
: doc.add( field.createField( field.getDefaultValue(), 1.0f ) );
: } else {
: + if (missingFields==null) {
: + missingFields = new ArrayList<String>(1);
: + }
-Hoss
Re: svn commit: r551060 - /lucene/solr/trunk/src/java/org/apache/solr/update/DocumentBuilder.java
Posted by Yonik Seeley <yo...@apache.org>.
On 6/27/07, Chris Hostetter <ho...@fucit.org> wrote:
>
> : check for null copyField source, delay some allocations
>
> i understanding delaying the allocation of missingFields, but why only a
> size of 1 once it is allocated?
Actually, it's an error case, so I don't really care about the speed
or memory consumption, as long as it only happens in that error case.
Could have just as easily left off the size.
-Yonik