lucene-solr-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Chris Hostetter <hossman_luc...@fucit.org>
Subject Re: svn commit: r551060 - /lucene/solr/trunk/src/java/org/apache/solr/update/DocumentBuilder.java
Date Wed, 27 Jun 2007 18:37:31 GMT

: 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


Mime
View raw message