Instead of using the existing “ANY”, “ALL”, or “EXACT” search type for multi-word searches, you can pass in minimum match parameter from the url.
This parameter gives you more flexibility in terms of specifying how many of the search keywords need to match the indexed documents. As an example, if user enters 2 search keywords and you set minMatch =2 that means the indexed fields of the returned documents need to contain both keywords. If you set minMatch = 2<80% 6<50% That means if there are less than 3 query keywords, both have to be found in the document; if it's between 3 and 6 query keywords (inclusive) , then 80% needs to match - for example user searches for 3 keywords, 80% of 3 is 2.4 and rounding down it down to 2, so results matching at least 2 of the 3 entered words will be returned, if more than 6 keywords, 50% of the keywords need t match in the document. Some examples of how to set the parameter: http://lucene.apache.org/solr/4_8_1/solr-core/org/apache/solr/util/doc-files/min-should-match.html
Please note that you need to configure the minimum match with the 'ANY' search type in order to achieve the aforementioned behavior.
Also, as Bleddyn addressed in his comment, minimum match doesn't work well when you define your synonyms through the search term association in the Management Centre. This is because the search term association expands the original search term before it passes them to Solr, and minMatch will act on the expended search terms instead of the original one. (I tested the synonyms problem described below using FEP 8)
For example, our store indexed products in the following categories: vitamin, grape, apple, and cheese, but no product's indexed fields contain the combination of any of these words (e.g. no single product has vitamin and grape indexed together). If you define vitamin, grape, apple and cheese to be synonyms in the Management Centre. And you set your minMatch=2. When you search for "vitamin" in the storefront, you will get no result. The reason is that the expanded search terms consist of 'vitamin, grape, apple and cheese' instead of just vitamin, and Solr is looking for a product which has at least 2 of the 4 terms indexed.
To solve this problem, instead of using Management Center, you can define your synonyms in the synonyms.txt file. This will feed the original search terms into Solr before the synonym expansion. To accomplish this, you will need:
(1) add a file called synonyms.txt and add it to the same folder that contains the schema.xml file. In it, you can define what synonyms list you want to include by following the correct formats: http://wiki.apache.org/solr/AnalyzersTokenizersTokenFilters#solr.SynonymFilterFactory
(2) You will need to add this to either (or both) the index and query section of wc_text field inside schema.xml file:
<filter class="solr.SynonymFilterFactory" synonyms="synonyms.txt" ignoreCase="true" expand="true"/>, screen shot below for only adding it to query section:
This way, you are passing the original search terms into solr. (Make sure you add the SynonymFitlerFactory filter before the SnowballPorterFilterFactory filter) Solr will do the synonyms matching. When you search for 'vitamin' with minMatch = 2, you will get all the vitamin products, along with grape, apple and cheese products returned.
In case if your synonyms list contain white space, for example, if you want to define spider man and spiderman to be synonyms, you will need to add the SynonymfiterFactory filter into the 'index' analyzer, followed by re-indexing. Here's an article that explains why:http://opensourceconnections.com/blog/2013/10/27/why-is-multi-term-synonyms-so-hard-in-solr/
Two steps needed in order to enable minimum match in FEP 6:
In get-data-config.xml (located in C:\WebSphere\AppServer\profiles\demo\installedApps\WC_demo_cell\WC_demo.ear\Stores.war\WEB-INF\config\com.ibm.commerce.catalog-fep), modify the getCatalogNavigationView expression builder by adding a new ‘minMatch’ param (highlighted in red below)
In the searchSetup.jspf file (located in C:\WebSphere\AppServer\profiles\demo\installedApps\WC_demo_cell\WC_demo.ear\Stores.war\AuroraStorefrontAssetStore\Common)
Add a new parameter called ‘minMatch’ into the <wcf:getData type="com.ibm.commerce.catalog.facade.datatypes.CatalogNavigationViewType"..> section, as highlighted in red below.
Note 1 - in this example, I assigned it a value of 2, which means at least 2 of the user search terms needs to match what’s being indexed in the document. You can change it to any other values that fits your business needs.
Note 2 - There are 2 appearances of the ‘ <wcf:getData type="com.ibm.commerce.catalog.facade.datatypes.CatalogNavigationViewType"..> section’ in the searchSetup.jspf file, you only need to add this minMatch parameter to the 1st appearance section for keyword search