You can add two kinds of entries to your thesaurus:
A
one-way
thesaurus entry, which establishes a mapping between a search term and its thesaurus entry that applies in a single direction only.For example, you can define a one-way mapping so that all queries on “tools” (the shopper’s search term) return matches containing “hammers” (a synonym for “tools” specified in the thesaurus) as well as matches on “tools”. Note, however, that this mapping works only one way: searching for the thesaurus entry “hammers” does not return matches containing the word “tools”.
A
multi-way
thesaurus entry, which specifies two-way mappings among two or more words or phrases that are treated as equivalents of each other.For example, a
multi-way
entry might specify that the terms “adapter”, “converter”, and “adapter converter” are equivalents of each other. A search on any one of these terms can return matches on any of the three.
The following table describes the JSON attributes that configure a thesaurus and thesaurus entries.
Attribute | Value |
---|---|
| The ecr-type of the node. The value can be |
| Can be generated by the system or specified by the user. Required for operations on a thesaurus entry. |
| One or more thesaurus entries. Each entry has the following attributes:
If If |
Example: thesaurus with two thesaurus-entry objects
The following JSON illustrates the configuration of a thesaurus
object containing two thesaurus-entry
objects: a one-way entry that configures “shirt” as a searchTerms
value and “blouse” as a synonyms
value; and a multi-way entry that configures “adapter”, “converter”, and “adapter-converter” as synonyms of each other. Note that the ID of one thesaurus-entry
object was generated by the system and the other was specified by the user; for information about how to specify the IDs of thesaurus-entry
objects, see Create thesaurus entries.
{ "ecr:type" : "thesaurus", "auto_generated_id
": { "ecr:type": "thesaurus-entry", "type": "one-way", "searchTerms": "shirt", "synonyms" : ["blouse"] }, "user_specified_id
": { "ecr:type": "thesaurus-entry", "type": "multi-way", "synonyms": [ "converter","adapter","adapter-converter" ] } }
Thus:
If a shopper enters “shirt” as a search term, records that include “blouse” appear in the search results; but if a shopper enters “blouse” as a search term, records that include “shirt” do not appear in the search results.
If a shopper enters any of the words “ adapter”, “converter”, or “ adapter-converter” as a search term, records that contain any of the three words appear in the search results.