: Looking for some help here. I upgraded from 9.7.0 to 9.8.1 recently
: and found that some fields were no longer being returned from
: searches. I've put together some instructions to show the issue below
: using the Solr docker image.
: 
: I wasn't expecting the response to change for a change in major
: version. Is this a bug?

Hmmm, yes.  It certainly looks like it.  Solr should be very happy to 
index & store a field value even if it is the empty string.


Some investigation...


1) your subject mentions 9.8.1, but as your docker test shows the problem 
was introduced between 9.7.0 and 9.8.0.  Additional testing indicates it 
still exists in 9.9.0



2) the problem isn't just with the empty string "no longer being returned" 
... it is no longer indexed either...

curl http://localhost:8983/solr/test/select --form-string 'q={!field 
f=field_one v=""}'

...which makes me suspect that the problem is something different with the 
injestion of the original string (before the value is either indexed or 
stored)



3) the problem doesn't reproduce if you start with the techproducts 
configset...

docker run -it --rm -p 8983:8983 --name solr solr:9.8.0 solr-precreate test 
/opt/solr/server/solr/configsets/sample_techproducts_configs

...which means the problem is likeley in something conifgurable that 
differs between the techproducts configs and the default configs?




4) Running 9.8.0 with SOLR_LOG_LEVEL+DEBUG i see this...

2025-08-01 19:01:16.269 DEBUG (qtp1574898980-21-null-3) [c: s: r: x:test 
t:null-3] o.a.s.u.p.FieldValueMutatingUpdateProcessor removing value from field 
'field_one': 
2025-08-01 19:01:16.271 DEBUG (qtp1574898980-21-null-3) [c: s: r: x:test 
t:null-3] o.a.s.u.p.AddSchemaFieldsUpdateProcessorFactory No fields or 
copyFields to add to the schema.

...which means even though 'update.autoCreateFields' is set to false, that 
processor chain still seems to be getting used?



5) setting this as a system property on solr startup *does* seem to 
work...

docker run -d --rm -p 8983:8983 --name solr -e 
'SOLR_OPTS=-Dupdate.autoCreateFields=false' solr:9.8.0 solr-precreate test

...which leads me to believe something was broken in when/how 
set-user-property can be used.


Bug created: https://issues.apache.org/jira/browse/SOLR-17834





: 
: 1. Start Solr
: 
: docker run -d --rm -p 8983:8983 --name solr solr:9.7.0 solr-precreate test
: 
: 2. Add a schema
: 
: curl http://localhost:8983/solr/test/schema \
:   -H 'Content-type:application/json' \
:   --data '{
:     "add-field": [
:         {
:             "name": "field_one",
:             "type": "string",
:             "indexed": true,
:             "stored": true,
:             "docValues": false
:         },
:         {
:             "name": "field_two",
:             "type": "string",
:             "indexed": true,
:             "stored": true,
:             "docValues": false
:         }
:     ]
: }'
: 
: 3. Set the user property update.autoCreateFields to false
: 
: curl http://localhost:8983/solr/test/config \
:   -d '{"set-user-property": {"update.autoCreateFields":"false"}}'
: 
: 4. Add a document to the index
: 
: curl 
'http://localhost:8983/solr/test/update?commitWithin=1000&overwrite=true' \
:   -H 'Accept: application/json, text/plain, */*' \
:   -H 'Content-type: text/xml' \
:   --data '<add>
:     <doc>
:         <field name="id">1</field>
:         <field name="field_one"></field>
:         <field name="field_two">something</field>
:     </doc>
:     </add>'
: 
: 5. Retrieve the document from the index
: 
: curl http://localhost:8983/solr/test/select \
:   --data-urlencode "indent=true" \
:   --data-urlencode "q=*:*" \
:   --data-urlencode "q.op=OR" \
:   --data-urlencode "useParams=" \
:   --data-urlencode "omitHeader=true"
: 
: Note the response has: `id`, `field_one`, and `field_two`. Even though
: `field_one` is empty.
: 
: {
:   "response":{
:     "numFound":1,
:     "start":0,
:     "numFoundExact":true,
:     "docs":[{
:       "id":"1",
:       "field_one":"",
:       "field_two":"something",
:       "_version_":1838961009907204096,
:       "_root_":"1"
:     }]
:   }
: }
: 
: 6. Perform steps 1-5 again but with the solr:9.8.0 image in the docker run.
: 
: The final result will be this response which doesn't have the
: `field_one` element at all.
: 
: {
:   "response":{
:     "numFound":1,
:     "start":0,
:     "numFoundExact":true,
:     "docs":[{
:       "id":"1",
:       "field_two":"something",
:       "_version_":1838961713879187456,
:       "_root_":"1"
:     }]
:   }
: }
: 
: Kind regards,
: Tim.
: 

-Hoss
http://www.lucidworks.com/

Reply via email to