Hi,

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?

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.

Reply via email to