On 2/15/2021 10:17 AM, Steven White wrote:
Yes, I have managed schema enabled like so:

   <schemaFactory class="ManagedIndexSchemaFactory">
     <bool name="mutable">true</bool>
     <str name="managedSchemaResourceName">cp-schema.xml</str>
   </schemaFactory>

The reason why I enabled it is so that I can dynamically customize the
schema based on what's in the DB.  So that I can add fields to the schema
dynamically.

A managed/mutable schema is a configuration detail that's separate from (and required by) the update processor that guesses unknown fields. It has been the default schema factory used in out-of-the box configurations for quite a while.

I guess a better question, to meet my need, is this: how do I tell Solr, in
schema-less mode, to use *my* defined field-type whenever it needs to
create a new field?

The config for that is described here:

https://lucene.apache.org/solr/guide/8_6/schemaless-mode.html#enable-field-class-guessing

It is a bad idea to rely on field guessing for a production index. Even the most carefully designed configuration cannot get it right every time. You're very likely to run into situations where the software's best guess turns out to be wrong for your needs. And then you're forced into what you should have done in the first place -- manually fixing the definition for that field, which usually also requires reindexing from scratch.

One counter-argument to what I stated in the last paragraph that frequently comes up is "my data is very well curated and consistent." But if that is the case, then you will know what fields and types are required *in advance* and you can easily construct a schema yourself before sending any data for indexing -- no guessing required.

Thanks,
Shawn

Reply via email to