Solr - custom text field is being processed as Long instead of Text/String

549 views Asked by At

I'm running Solr 7.5 for a Sitecore 9.2 instance. I added a custom field type to the Solr schema (/conf/managed-schema.xml), so that I can search on string fields case-insensitively, based on this post

<fieldType name="string_ci" class="solr.TextField" sortMissingLast="true" omitNorms="true">
    <analyzer type="query">
        <tokenizer class="solr.KeywordTokenizerFactory"/>
        <filter class="solr.LowerCaseFilterFactory"/>
    </analyzer>
</fieldType>

I have the field in my site's solr config:

<field fieldName="c_item_part_number_ci" returnType="string_ci">Feature.Products.ComputedFields.ItemPartNumberField,Feature.Products</field>

But in my Solr admin, it's showing as a LongPoint field, and when I try to index my items, I get an error, because I'm trying to pass text but it's expecting a number (the field is called Item Part Number but it can contain text, in this case "Compact-Item-20")

enter image description here

<lst name="responseHeader">
  <int name="status">400</int>
  <int name="QTime">246</int>
</lst>
<lst name="error">
  <lst name="metadata">
    <str name="error-class">org.apache.solr.common.SolrException</str>
    <str name="root-error-class">java.lang.NumberFormatException</str>
  </lst>
  <str name="msg">ERROR: [doc=sitecore://web/{46730869-114b-47ab-9c71-218fbe858caf}?lang=en&amp;ver=1&amp;ndx=sitecore_web_index] Error adding field 'c_item_part_number_ci'='CAB' msg=For input string: "CAB"</str>
  <int name="code">400</int>
</lst>
</response>
0

There are 0 answers