Li Enlai created SOLR-18627:
-------------------------------

             Summary: ignored fields throw NPE since StrField.createFields() 
switched to List.of
                 Key: SOLR-18627
                 URL: https://issues.apache.org/jira/browse/SOLR-18627
             Project: Solr
          Issue Type: Bug
          Components: Schema and Analysis
    Affects Versions: 10.1
            Reporter: Li Enlai


Writing a document that contains an ignored_* field works on Solr 10.0 and 
fails on 10.1. The whole update is rejected with 400, not just the ignored 
field.

The demo config has dynamicField ignored_* of type ignored (a StrField with 
indexed=false, stored=false, docValues=false):

{code}
curl http://localhost:8983/solr/demo/update/json/docs \
  -H 'Content-Type: application/json' \
  -d '{"id":"test","ignored_field":"foobar"}'
{code}

Solr 10.0 returns status 0. Solr 10.1 returns status 400. The root cause is a 
NullPointerException while adding the field.

Reported on users@:
https://lists.apache.org/thread.html/28pqz7gkvr3tb3mrj7f9npvs8f6slqq5

FieldType.createField() returns null when the field is neither indexed nor 
stored. DocumentBuilder already skips null fields. StrField.createFields() used 
to return Collections.singletonList(fval), which accepts null. Since 10.1 it 
returns List.of(fval), which does not. List.of throws before the field can be 
dropped, and DocumentBuilder fails the entire document.

David Smiley confirmed on dev@ that this is not the expected behavior, and that 
a test is missing (subject: "Re: ignored fields throw NPE since Solr 10.1").

The fix is to return an empty list when fval is null.



--
This message was sent by Atlassian Jira
(v10.3.26#10030026)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to