Synonyms

As of Dynamicweb 9.8 the Indexing engine supports synonyms – so that a user searching for ‘inches’ will also find products using e.g. inch or in. in the description.

First, create field type using the SynonymAnalyzer (Figure 1.1).

Figure 1.1 A field type using the SynonymAnalyzer

Then add a field of this type to the index containing the data you want to match to synonyms – in this case the long description. This field must be indexed and analyzed (Figure 1.2).

Figure 1.2 Add a field to the index using the new field type

Now go to /Files/System/Repositories/{NameOfYourRepository} and create 2 files:

  • A config file which handles what analyzers to use
  • An xml file containing a list of synonyms

Both files must be named bases on the system name of the field type you created previously – in this case WithSynonyms.config and WithSynonyms_synonyms.xml. Download an example of both files.

Currently we do not supply any synonym lists out of the box, but you should be able to scrape data from an online source.

Add a query expression using this field to your existing free text search section(Figure 1.3).

Figure 1.3 Check against the new field in the index

Make sure you rebuild the index, and that you have products using the synonyms in your product catalog – searching for any of terms in the synonym file will now return products using any of the other synonyms (Figure 2.1).