To broaden the search for product information that is performed when a shopper searches on a given term, you can specify one or more thesaurus entries for that term. The search results include matches on the thesaurus entries as well as on the search term.
Before you create thesaurus entries, you must first create a thesaurus. You then create one or more thesaurus entries in the thesaurus.
You can add two kinds of entries to your thesaurus:
A one-way thesaurus entry, which establishes a mapping between a search term and a synonym 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 synonym "hammers" does not return matches containing the word "tools".
or
An equivalent thesaurus entry, which specifies two-way mappings between two or more words or phrases that are treated as synonyms of each other.
For example, an equivalent entry might specify that the terms "adapter", "converter", and "adapter converter" are synonyms 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.
The following JSON configures two thesaurus entries: a one-way entry that configures "opt" as a synonym for the search term "optical" ; and an equivalent entry that configures "easy share", and "easyshare" as synonyms of each other:
{ "ecr:type": "thesaurus", "ecr:lastModifiedBy": "admin", "ecr:lastModified": "2016-06-16T11:56:40.399-04:00", "ecr:createDate": "2016-06-09T11:26:26.182-04:00", "0_auto_generated_id": { "ecr:type": "thesaurus-entry", "ecr:lastModifiedBy": "admin", "ecr:lastModified": "2016-06-16T11:56:40.399-04:00", "ecr:createDate": "2016-06-09T11:26:26.182-04:00", "synonyms": ["opt"], "type": "one-way", "searchTerms": "optical" }, "1_user_specified_id": { "ecr:type": "thesaurus-entry", "ecr:lastModifiedBy": "admin", "ecr:lastModified": "2016-06-16T11:56:40.399-04:00", "ecr:createDate": "2016-06-09T11:26:26.182-04:00", "synonyms": [ "easy share", "easyshare" ], "type": "equivalent" } }
Thus:
If a shopper enters "optical" as a search term, records that include "opt" appear in the search results; but if a shopper enters "opt" as a search term, records that include "optical" do not appear in the search results.
If a shopper enters either of the synonyms " easy share" or " easyshare" as a search term, records that contain the other synonym appear in the search results.
This section describes how to view, create, replace, and modify the thesaurus, either locally or remotely.
You can create and
modify thesaurus configuration locally using the IFCR command
importContent
. You can export the configuration for
viewing and archiving using the IFCR command
exportContent
.
To execute these commands, use the
runcommand[.bat|.sh]
script, which is installed by
default in the
/Endeca/Apps/application/control
directory. For
example:
/Endeca/Apps/Discover/control/runcommand.bat IFCR exportContent thesaurus D:\Export\Temp\
You typically use these commands in the following sequence:
To export configuration of the thesaurus in a ZIP file, execute the
following
exportContent
command:
runcommand.bat IFCR exportContent thesaurus D:\Export\Temp\
where
\Temp
is the local directory into which the ZIP
containing thesaurus configuration is exported. The exported configuration
includes the
thesaurus-entries
object and all individual entries.
To import configuration of the thesaurus in a ZIP file, execute an
importContent
command of the following form:
runcommand.bat IFCR importContent thesaurus pathname\filename.zip
where
filename.zip is the ZIP file containing the
thesaurus
configuration that is imported.
You can create and modify thesaurus configuration remotely using the Search and Navigation REST API .
To export thesaurus configuration in ZIP format, execute the following GET request:
GET /gsadmin/v1/Discover/thesaurus.zip
To export thesaurus configuration in JSON format, execute the following GET request
GET /gsadmin/v1/Discover/thesaurus.json
or
GET /gsadmin/v1/Discover/Discover/thesaurus
The following sample illustrates a response that can be returned by the GET requests above:
{ "ecr:type": "thesaurus", "ecr:lastModifiedBy": "admin", "ecr:lastModified": "2016-06-16T11:56:40.399-04:00", "ecr:createDate": "2016-06-09T11:26:26.182-04:00", "0_auto_generated_id": { "ecr:type": "thesaurus-entry", "ecr:lastModifiedBy": "admin", "ecr:lastModified": "2016-06-16T11:56:40.399-04:00", "ecr:createDate": "2016-06-09T11:26:26.182-04:00", "synonyms": ["opt"], "type": "one-way", "searchTerms": "optical" }, "1_user_specified_id": { "ecr:type": "thesaurus-entry", "ecr:lastModifiedBy": "admin", "ecr:lastModified": "2016-06-16T11:56:40.399-04:00", "ecr:createDate": "2016-06-09T11:26:26.182-04:00", "synonyms": [ "easy share", "easyshare" ], "type": "multi-way" } }
To export
thesaurus-entry
configuration in ZIP format, execute
the following GET request:
GET /gsadmin/v1/Discover/thesaurus/thesaurus-entry-id.zip
To export
thesaurus-entry
configuration in JSON format, execute
the following GET request
GET /gsadmin/v1/Discover/thesaurus/thesaurus-entry-id.json
or
GET /gsadmin/v1/Discover/Discover/thesaurus/thesaurus-entry-id
The following sample illustrates a response that can be returned by the GET requests above:
{ "ecr:type": "thesaurus-entry", "ecr:lastModifiedBy": "admin", "ecr:lastModified": "2016-06-16T11:56:40.399-04:00", "ecr:createDate": "2016-06-09T11:26:26.182-04:00", "synonyms": ["opt"], "type": "one-way", "searchTerms": "optical" }
To create thesaurus configuration remotely, when none currently exists, execute the following POST request:
POST http://host:port/ifcr/gsadmin/v1/Discover/thesaurus
For example, the following input to the POST request above creates a
thesaurus
containing a single
thesaurus-entry
with a user-specified ID:
{ "ecr:type": "thesaurus", "0_user_specified_id": { "ecr:type": "thesaurus-entry", "synonyms": ["opt"], "type": "one-way", "searchTerms": "optical" } // Other thesaurus entries }
To create a
thesaurus-entry
object remotely, execute the following
POST request:
POST http://host:port/ifcr/gsadmin/v1/Discover/thesaurus/my-thesaurus-entry
For example, the following JSON configuration can be provided as input
to the POST request above to create an theasaurus entry named
my-thesaurus-entry
:
{ "synonyms":[ "FM", "frequency modulation" ], "ecr:lastModifiedBy":"admin", "ecr:lastModified":"2017-01-25T16:38:21.316-05:00", "type":"multi-way", "ecr:createDate":"2017-01-25T16:38:21.316-05:00", "ecr:type":"thesaurus-entry" }
To replace the current configuration of the thesaurus remotely, execute the following PUT request:
PUT http://host:port/ifcr/gsadmin/v1/Discover/thesaurus
Note: The
PUT
method can be used only in JSON format. For
information, see
Understand ZIP format and
JSON format (remote access only).
For example, the following input to the PUT request above entirely
replaces the existing
thesaurus
and all of its thesaurus-entry objects:
{ "ecr:type": "thesaurus", "user_specified_id": { "ecr:type": "thesaurus-entry", "synonyms": ["opt"], "type": "one-way", "searchTerms": "optical" } // Other thesaurus entries }
To replace a
thesaurus-entry
object remotely, execute the following
PUT request:
PUT http://host:port/ifcr/gsadmin/v1/Discover/thesaurus/my-thesaurus-entry
To modify the current configuration of the thesaurus remotely, execute the following PATCH request:
PATCH http://host:port/ifcr/gsadmin/v1/Discover/thesaurus
Note: The
PATCH
method can be used only in JSON format. For
information, see
Understand ZIP format and
JSON format (remote access only).
For example, the following input to the PATCH request above entirely
modifies the
thesaurus-entry
object specified by
user_specified_id:
{
"ecr:type": "thesaurus",
"user_specified_id": {
"ecr:type": "thesaurus-entry",
"synonyms": ["opt"],
"type": "one-way",
"searchTerms": "optical"
}
}
If the
thesaurus-entry
with the ID "user_specified_id"
does not exist, the thesaurus-entry configured by this input is added to
the thesaurus.
If a
thesaurus-entry
with the ID "user_specified_id"
already exists, this
thesaurus-entry
is updated with the new properties and
values provided in this input.
To modify a
thesaurus-entry
object remotely, execute the following
PATCH request:
PATCH http://host:port/ifcr/gsadmin/v1/Discover/thesaurus/my-thesaurus-entry