Introduced in Feature Pack 2

Troubleshooting: Search relevancy

Consult the following troubleshooting tips if you encounter errors or issues when working with WebSphere Commerce search relevancy.

  • If you set the search type to be exact match, and the expected products are not returned, ensure that the stopwords.txt file does not contain part of the search phrase. For example, if the stopwords.txt file contains a, searches for a red dress will result in no search results.
  • Ensure that you use the correct filters, tokenizers, and other field definitions in the schema.xml file. If stemming is used, ensure that you include the words you do not want stemmed in the protwords.txt file.
  • Ensure that you apply the latest WebSphere Commerce fixes:
  • Ensure that the fields you are searching for are marked as searchable. Verify their searchable status in the schema.xml file, wc-search.xml file, and the attribute dictionary.
  • You can modify search profiles to suit your business needs.

    In the wc-search.xml file, you can modify the search profiles using the following sample:

    By default:
    
    <_config:query inherits="true"> 
      <_config:field name="defaultSearch" /> 
      <_config:field name="shortDescription"/> 
    </_config:query> 
    
    With new fields:
    
    <_config:query inherits="true"> 
      <_config:field name="defaultSearch" /> 
      <_config:field name="shortDescription"/> 
      <_config:field name="newField"/> 
    </_config:query> 
    

    Where adding <_config:field name=" newField "/> ensures that Solr searches in the new field called newField, in addition to the shortDescription and defaultSearch fields.

    Ensure that the new field is marked with indexed="true" and stored="true" in the wc-search.xml file.

  • Ensure that you restart the correct server after making changes. For example, if you change any of the XML configuration files in the Search_eardir, you must restart the WebSphere Commerce search server.
  • If you encounter errors in the storefront, the detailed error message is typically logged in the systemOut.log file and trace.log file.
  • If all the search results returned are irrelevant, you can enable foundation and catalog logs (com.ibm.commerce.foundation.*=all: com.ibm.commerce.catalog.*=all) for more details:
    1. Perform the search in the storefront. Search for the final solr query in the trace.log file. The final Solr query is what is passed into Solr. Ensure that your query is constructed correctly before it is passed to Solr.
    2. If the query is correct, check the search index. Before passing the Solr query directly to the index, ensure that you fully rebuilt the search index after changing the schema.xml file. In addition, ensure that you pass all the required parameters during re-indexing, and restarted the search server when required.

      For example, the following URL checks the indexed catalog entries: http://localhost/solr/MC_10001_CatalogEntry_en_US/select?q=*:*

    3. If the results returned from the search index are correct, ensure that you do not depend on additional data from the database. The database data must be accurate and not duplicated. Ensure that the search profiles in the wc-search.xml are set correctly, and contain the appropriate fields for searching. For example, if you are searching for the field name, under the <_config:query> section, ensure that the search profile contains the category name field: <_config:field name="name"/>. Then, pass the same final Solr query expression found in the trace.log file (removing the wt=json&json.nl=map section) and confirm the results.
  • If you encounter timeout errors, ensure that the server is on and that it is configured correctly. For example, the namespace bindings, Solr application server, web server, and plugin. Ensure that the timeout intervals are set correctly, and that the correct user permissions are granted.
  • You can display and modify the content of your current search index using Lucene's Luke. You can view the search index using Luke in the following ways:
    • Using the command line: Enter java -jar lukeall-3.5.0.jar.
    • Using a web browser: Uncomment the following line in the solrconfig.xml file: <requestHandler name="/admin/luke" class="solr.admin.LukeRequestHandler" />. Restart the search server. Then you can view the data in a web browser using the following URL as a sample: http://localhost/solr/MC_10001_CatalogEntry_en_US/admin/luke?docId=2 For more information, see LukeRequestHandler.