Inventory and custom fields in a custom search profile
You can add custom fields in the search profile by editing your ZooKeeper configuration.
Before you begin
ZooKeeper stores named profiles in one of its nodes. You
can create, update, delete the profiles, and get profiles using the profiles
endpoint of the Query service. The endpoint for the profile
is:
https://data_environment_hostname:30921/search/resources/api/v2/documents/profiles/profileName
No
container needs to be restarted after you add a profile using this
endpoint.Ensure that you have mapped the field name in the ZooKeeper component node, as in the
following example. To understand how search profiles are managed in ZooKeeper, see
Configuring Query services in ZooKeeper. For more information
about search profiles, see Search profiles.
{
"valuemappingservice": {
"valuemapping": [
{
"internalName": "CatalogEntryUserDataFieldNameMapping",
"externalName": "CatalogEntryUserDataFieldNameMapping",
"valuemap": [
{
"externalValue": "inventories.*.quantity",
"internalValue": "inventories.*.quantity"
},
{
"externalValue": "workspace",
"internalValue": "workspaceName"
}
]
}
]
}
}
For inventory fields, search for parameters according to the pattern
inventories.*.quantity
. This search returns all numbered
inventory items; for example, inventories.10501.quantity
.Procedure
-
Use the following procedure to add term searches.
-
2) For Category Browsing
Formatting fields with names that end in *
To format fields that end with * in the value mapping service in json, set
formatUserData to the value true
in the value
mappings SearchConfiguration
section. By default, the value is
true
for this flag.
Example
Following is a sample profile.
{
"parentProfileName": "HCL_findProductsBySearchTerm",
"profileName": "X_findProductsBySearchTerm",
"lookupProfileName": "X_findCatalogEntryById",
"query": {
"responseFields": [
"test.list",
"test1.list1",
"category.10001-10001.*"
]
}
}
{
"parentProfileName": "HCL_findCatalogEntryById",
"profileName": "X_findCatalogEntryById",
"query": {
"responseFields": [
"test.list",
"test1.list1",
"category.10001-10001.*"
]
}
}
Sample mapping for custom
fields: {
"valuemappingservice": {
"valuemapping": [
{
"internalName": "CatalogEntryUserDataFieldNameMapping",
"externalName": "CatalogEntryUserDataFieldNameMapping",
"valuemap": [
{
"externalValue": "List",
"internalValue": "test.*"
},
{
"externalValue": "List1",
"internalValue": "test1.list1"
},
{
"externalValue": "CategoryDetails",
"internalValue": "category.*"
}
]
}
]
}
}
After executing the term search API, the User Data section with
custom fields is returned in the
response."UserData": [
{
"List1": [
"10",
"20"
],
"CategoryDetails": [
{
"10001-10001": {
"id": "10001",
"name": "dresses",
"sequence": "1.0"
}
}
],
"List": [
{
"list": "10"
},
{
"list": "20"
}
]
}
]
For List
and List1
the response structure is
different, because there are different mapping in the value mapping section. If
the full field path is specified, a list similar to List1 will be returned. If
the wildcard * is use in the field mapping, it will be formatted as a json
object similar to the example List object.
Note: Do not override the following profiles. They are for HCL
internal use only.
- HCL_findCatalogEntryByIdForBrowse
- HCL_findCatalogEntryById