List Info

Thread: Re: svn commit: r551060 - /lucene/solr/trunk/src/java/org/apache/solr/update/DocumentBuilder.java




Re: svn commit: r551060 - /lucene/solr/trunk/src/java/org/apache/s olr/update/DocumentBuilder.java
country flaguser name
United States
2007-06-27 13:37:31
: 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/s olr/update/DocumentBuilder.java
user name
2007-06-27 13:53:24
On 6/27/07, Chris Hostetter <hossman_lucenefucit.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

[1-2]

about | contact  Other archives ( Real Estate discussion Medical topics )