Combining minimum match with search term associations (using the Solr expansion algorithm)
You can combine minimum match with search term associations, if you use the Solr synonym expansion algorithm. This option is often used along with the auto-phrase filter to enable multi-word search term associations.
About this task
- A single synonyms.txt file per master catalog is supported. The same synonyms.txt file is shared by all extended sites.
- Multiple word synonyms or replacement terms are not supported.
- If the HCL Commerce and search servers are on separate nodes in the authoring environment, transfer the synonyms.txt file from the HCL Commerce server to the search server. Repeat this process after every Management Center search term association update. Transfer the file by using NFS file transfer or manually copying the file. The file is then replicated to the subordinate servers in the production environment.
Procedure
- Open the LOBTools\WebContent\config\commerce\catalog\objectDefinitions\SearchTermAssociationsPrimaryObjectDefinition.def file for editing:
-
Uncomment the following section:
<!--Comments out the following definition to prevent generating "synonyms.txt" for solr server.--> <PostSaveService url="/cmc/PublishSearchTermAssociations"> <ServiceParam name="storeId"/> </PostSaveService>
- Save your changes and close the file.
-
Open the following file for editing:
- solrhome/MC_masterCatalogId/locale_name/Catalogentry/conf/schema.xml
If you want unstructured content to behave in the same way, also open the following file for editing:- solrhome/MC_masterCatalogId/locale_name/Catalogentry/conf/unstructured/schema.xml
-
Add the following filter class snippet to the file, within the
wc_text
query analyzer block, before theSnowballPorterFilterFactory
filter, and after theWhitespaceTokenizerFactory
:<filter class="solr.SynonymFilterFactory" synonyms="synonyms.txt" ignoreCase="true" expand="true"/>
If you are updating the unstructured content schema.xml file, make the following update:<filter class="solr.SynonymFilterFactory" synonyms="../../synonyms.txt" ignoreCase="true" expand="true"/>
- Save your changes and close the file.
-
Update all versions of the HCL Commerce Search configuration file
(wc-search.xml):
- On the WC EAR: workspace_dir/WC/xml/config/com.ibm.commerce.catalog-ext/wc-search.xml
- On the Search EAR: Search_eardir/xml/config/com.ibm.commerce.catalog-ext/wc-search.xml
Add
synonym="/conf/synonyms.txt"
into the CatalogEntry core.<_config:core catalog="10001" indexName="CatalogEntry" language="en_US" name="MC_10001_CatalogEntry_en_US" path="/MC_10001/en_US/CatalogEntry" serverName="BasicConfiguration" synonym="/conf/synonyms.txt"/>
If you want unstructured content to behave in the same way, update the UnstructuredContent core.<_config:core catalog="10001" indexName="UnstructuredContent" language="en_US" name="MC_10001_CatalogEntry_Unstructured_en_US" path="/MC_10001/en_US/CatalogEntry/unstructured" serverName="BasicConfiguration" synonym="/conf/synonyms.txt"/>
For more information, see Search configuration.
-
Ensure that the synonyms.txt file exists in the following directory:
solrhome/MC_masterCatalogId/locale_name/Catalogentry/conf
Important: The Management Center automatically updates the synonyms.txt only on the HCL Commerce server in the preceding location.
If your HCL Commerce and search servers are in separate nodes in the authoring environment, ensure that the synonyms.txt file exists on both the HCL Commerce and search nodes.
Then, synchronize the search server's version of the file with the updated HCL Commerce version of the file. That is, the synonyms.txt file must be transferred from the HCL Commerce server to the search server after each search term association update in the Management Center. Doing so ensures that changes made in the HCL Commerce authoring environment are also reflected on the search server.
-
To synchronizing Solr configuration files, such as stopwords.txt, x-schema.xml and synonyms.txt
between master and subordinate servers, you can simply deploy the same Docker images on each
node.
For each master/subordinate combination, modify the polling interval and Master URL to customize Solr behavior. You cannot change the solrconfig.xml configuration file directly; instead, use one of the methods described in Extending the solrconfig.xml file to change the variables. For example, you can change the value of the polling interval via the solr.replication.pollInterval parameter in the SRCHCONFEXT database table. The Master URL can similarly be customized by changing the solr.master.server.url parameter. For example:
where master_hostname and master_https_port are the values specific to your environment. If instead you customize solrconfig.xml by editing the jvm.options file (as described in Extending the solrconfig.xml file), add the following lines to jvm.options:update srchconfext set config='solr.master.server.url=master_hostname:master_https_port, solr.replication.pollInterval=00:00:10' where srchconfext_id=srchconfext_id;
-Dsolr.master.server.url=master_hostname:master_https_port -Dsolr.replication.pollInterval=00:00:10
- You can transfer existing search term associations from the Management Center to the synonyms.txt file. To do so, trigger a minor change in either the synonym or replacement terms then save your change.