cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

How to add a custom new field type to Solr?

Former Member
0 Kudos
2,165

Like string, text etc, can we add a new field type to be tagged to the indexed property to allow custom processing for a specific field

Accepted Solutions (0)

Answers (2)

Answers (2)

former_member1320010
Participant
0 Kudos

Hi you could try adding this in the schema.xml present under /config/solr/

 <fieldType name="textsample" class="solr.TextField" positionIncrementGap="100">
             <analyzer>
                 <tokenizer class="solr.StandardTokenizerFactory" />
                 <filter class="solr.StopFilterFactory" words="lang/stopwords_en.txt" ignoreCase="true" />
                 <filter class="solr.ManagedStopFilterFactory" managed="en" />
                 <filter class="solr.SynonymFilterFactory" ignoreCase="true" synonyms="synonyms.txt"/>
                 <filter class="solr.ManagedSynonymFilterFactory" managed="en" />
                 <filter class="solr.WordDelimiterFilterFactory"  preserveOriginal="1"
                     generateWordParts="1" generateNumberParts="0" catenateWords="1"
                     catenateNumbers="0" catenateAll="0" splitOnCaseChange="1" />
                 <filter class="solr.LowerCaseFilterFactory" />
                 <filter class="solr.KeywordRepeatFilterFactory"/>
                 <filter class="solr.SnowballPorterFilterFactory" protected="protwords.txt" language="English" />
                 <filter class="solr.RemoveDuplicatesTokenFilterFactory"/>
             </analyzer>
         </fieldType>
Former Member
0 Kudos

Thanks. Yes this I already did and it works when queried directly in Solr, but not in hybris

former_member1320010
Participant
0 Kudos

What other configurations did u already add ?

Do you have the below enum ?

         <value code="textsample" />
     </enumtype>
Former Member
0 Kudos

Thanks. Yes and getting this Error from server at http://localhost:8983/solr: ERROR: [doc=dtGlobalProductCatalog/Online/12866] unknown field 'dtTireSize_tiresearch'

This is even after I removed the core completely and re-run the index

"tiresearch" is the new fieldType

Former Member
0 Kudos

Adding below makes it work. The mapping needed to be configured manually

dynamicField name="*_tiresearch" type="tiresearch" indexed="true" stored="true"

Former Member
0 Kudos

Hi Niranjan,

https://help.hybris.com/1811/hcd/8c7dea5386691014aceaa6b5ab3e31b9.html

Please go through this link and write value resolver for the custom field and add the property in the solr.impex along with the resolver bean.

I hope this might help you.

Thanks,

G Gopinath.

Former Member
0 Kudos

I believe you are talking about adding a new field. I was saying about field type. If you see currently, there is SolrPropertiesType Enum which has string, text etc. How do we add a new custom field type to this. I was able to add, and assign to fields but the issue was when it interacted with the Solr server