Skip to Content

how to modify solr search in Hybris to remove special charecters

if Customer Part # is 48-32-4024, then the user will be search both ways "48-32-4024" or as "48324024"

Add a comment
10|10000 characters needed characters exceeded

Related questions

1 Answer

  • Posted on Nov 07, 2019 at 02:13 AM

    Hi Mahendher,

    In solr schema.xml, use WordDelimiterFilterFactory for the corresponding field type.

    Example: Below snippet is a good starting point.

    <analyzer type="index">
     ..
     <filter class="solr.WordDelimiterFilterFactory" generateWordParts="1" catenateNumbers="1"/> 
     ...
    </analyzer>
    <analyzer type="query">
     ...
     <filter class="solr.WordDelimiterFilterFactory" generateWordParts="1" catenateNumbers="0"  /> 
     ...
    </analyzer>
    

    'catenateNumbers' is the one that does the trick for you.

    From solr documentation -

    catenateNumbers - (integer, default 0) If non-zero, maximal runs of number parts will be joined: 1947-32" ? "194732"

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.