1

I have an external Apache Solr Server, with Search API and Search API Views.

When we search for ordinary products, they are shown correctly, with the correct descending relevance order.

When we search for a product with the exact name: "Productx-123W" it is showing in this order (with highlighted terms by search function):

  • Productx-123D
  • Productx-123S
  • Productx-123
  • Productx-123W

So the exact product name is only shown on the 4th place, while all other products with no hyphens or - in them have the correct displayed order in the results.

It is like the hyphen splits the word in two.

Secondly, I have a product: Product20001w When I look for this search term: "2000" nothing is shown. It's like the numbers on the end confuse the server. When I look for "2001w", it shows the right products which have partially this "2001w" in their name.

Anyone knows how to fix this?

  • Do you have any custom configuration in your Solr? Can you post it? – kenorb Mar 9 '18 at 15:04
  • Hi, I just received the config files from "Hosted Apache Solr" hostedapachesolr.com Here you can download the files: (thanks) omegaservers.be/config-apache-solr.zip – Summer Mar 20 '18 at 11:39
  • I think Search API Solr module should have a tab where you can see the content of loaded config files as well. – kenorb Mar 20 '18 at 11:47
  • You are right. there are a bunch of config files there. I didn't change anything there. Can I tweak something to make hyphens in a word be seen as real letters and treated as such ? – Summer Mar 20 '18 at 11:47
0

It is basically a feature of Word Delimiter Filter to allow matching of words on case-change, alphanumeric boundaries, and non-alphanumeric chars, so when typing "wifi", "wi fi" could match documents containing "Wi-Fi". That is why Product-123A is split to match more products. See: Intra-Word Delimiters.

So you can either disable WordDelimiterFilter, or customize it. For example:

<filter class="solr.WordDelimiterFilterFactory"
        protected="protwords.txt"
        generateWordParts="1"
        generateNumberParts="1"
        catenateWords="0"
        catenateNumbers="0"
        catenateAll="0"
        splitOnCaseChange="0"
        preserveOriginal="1"/>

Since the second part of your word consist number (e.g. 123W), you may try to enable catenateWords and catenateNumbers (set to 1) in your schema.xml file and apply the changes to your hosted Solr server.

You can also provide some customization usingwdftypes.txt file, see: SOLR-2059.

However, if you want to keep the feature as it is (without modifying any Solr config files), you can also consider increasing the score for certain fields, such as titles (e.g. a product name). So your Productx-123W phrase after a word split will match higher on documents with partial matches such as 123W in specific fields.

Related posts:

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.