On 2/15/2021 6:52 AM, Steven White wrote:
It looks to me that SolrInputDocument.addField() is either missnamed or
isn't well implemented.

When it is called on a field that doesn't exist in the schema, it will
create that field and give it a type based on the data.  Not only that, it
will set default values.  For example, this call

     SolrInputDocument doc = new SolrInputDocument();
     doc.addField("Company", "ACM company");

Will create the following:

     <field name="Company" type="text_general"/>
     <copyField source="Company" dest="Company_str" maxChars="256"/>

That SolrJ code does not make those changes to your schema. At least not in the way you're thinking.

It sounds to me like your solrconfig.xml includes what we call "schemaless mode" -- an update processor that adds unknown fields when they are indexed. You should disable it. We strongly recommend never using it in production, because it can make the wrong guess about which fieldType is required. The fieldType chosen has very little to do with the SolrJ code. It is controlled by what's in solrconfig.xml.

Thanks,
Shawn

Reply via email to