Hello!

The client API allows for specifying input documents to be indexed.

For example:

final var document = new SolrInputDocument();
document.addField("x", "a");
document.addField("y", "b");
document.addField("z", "c");
client.add(collection, document);

If there is a schema on the server-side that gives the types of "x",
"y", and "z", then they will be assigned the correct types when the
document is indexed. However, if those fields _aren't_ in the schema,
then they'll almost certainly be assigned some kind of text type as
a fallback.

The documentation for addField() says:

"
Add a field value to any existing values that may or may not exist.
The class type of value and the name parameter should match schema. xml.
schema. xml can be found in conf directory under the solr home by default.
Params:
name – Name of the field, should match one of the field names defined
under "fields" tag in schema. xml.
value – Value of the field, should be of same class type as defined by
"type" attribute of the corresponding field in schema. xml.
"

I assume that "of same class type" is referring to the various solr.*
types such as solr.UUIDField, solr.BoolField, and so on. This
documentation already seems incorrect because I'm clearly passing
string constant values above and they're being accepted.

If I want to _actually_ provide values of the solr.* classes, then I
have to pull in solr-core as a dependency, which seems to bring in
a ton of server-side components. Even then, it's not clear to me how
I'm supposed to create values of, for example, solr.UUIDField as the
classes seem to be about the types of fields, not the values of fields.

I can specify the types of most of the fields in my schema, but there
are some fields where I don't know their exact types ahead of time. How
do I pass values of these types to the API such that they'll have a type
inferred that's more precise than just text?

-- 
Mark Raynsford | https://www.io7m.com

Reply via email to