On 2/14/2021 9:00 AM, Steven White wrote:
It looks like I'm misusing SolrJ API SolrInputDocument.addField() thus I
need clarification.
Here is an example of what I have in my code:
SolrInputDocument doc = new SolrInputDocument();
doc.addField("MyFieldOne", "some data");
doc.addField("MyFieldTwo", 100);
The above code is creating 2 fields for me (if they don't exist already)
and then indexing the data to those fields. The data is "some data" and
the number 100 However, when the field is created, it is not using the
field type that I custom created in my schema. My question is, how do I
tell addField() to use my custom field type?
There is no way in SolrJ code to control which fieldType is used. That
is controlled solely by the server-side schema definition.
How do you know that Solr is not using the correct fieldType? If you
are looking at the documents returned by a search and aren't seeing the
transformations described in the schema, you're looking in the wrong place.
Solr search results always returns what was originally sent in for
indexing. Only Update Processors (defined in solrconfig.xml, not the
schema) can affect what gets returned in results, fieldType definitions
NEVER affect data returned in search results.
Thanks,
Shawn