Products containing a hyphen or numbers not shown or wrong relevance 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?
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:

&lt;filter class="solr.WordDelimiterFilterFactory"
        protected="protwords.txt"
        generateWordParts="1"
        generateNumberParts="1"
        catenateWords="0"
        catenateNumbers="0"
        catenateAll="0"
        splitOnCaseChange="0"
        preserveOriginal="1"/&gt;


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:


Search with various combinations of space, hyphen, casing and punctuations
Quering numbers containing hyphens with SOLR WordDelimiterFilterFactory isn't working?