You can create, modify, view, and delete index attribute configuration remotely, using the Index Attributes API.

This section describes how to create and configure index attributes using the Index Attributes API.

The JSON configuration of index attributes is stored in the collection folder /config/import/attributes, which is located in your application's installation directory.

Typically, a /config/import/attributes folder and a /system subfolder are created when a Guided Search application is initialized. If the /attributes folder does not exist on your system, you must create it before you can create index attributes.

To create the attributes folder, use the following endpoint on the Guided Search server:

POST http://host:port/ifcr/gsadmin/v1/Discover/attributes

Use the following request body with the POST request above to create the attributes folder without content:

{ "ecr:type": "attributes-folder" }

The endpoint above can also create owners in the attributes folder when it creates the folder. To do this, provide a request body such as the following, which creates two different owners, "ownerOne" and "MEDIA":

{ 
   "ecr:type":"attributes-folder",
   "ownerOne":{ 
      "ecr:type":"attributes-owner-folder", 
      "camera.35_mm_camera_lens_equivalent":{ 
        "propertyDataType":"ALPHA", 
        "sourcePropertyNames":[ 
           "camera.35 mm camera lens equivalent" 
        ], 
        "ecr:type":"property"
      }, 
      "camera.color":{ 
         "isWildcardEnabledInRecordSearch":true, 
         "displayOrder":4, 
         "sourcePropertyNames":[ 
            "camera.Colour of product" 
         ], 
         "isAutogen":true, 
         "isRecordSearchEnabled":true, 
         "ecr:type":"dimension" 
      }, 
      "product.max_price":{ 
         "derivedPropertySource":"product.price", 
         "derivedPropertyFunction":"MAX", 
         "ecr:type":"derived-property" 
      } 
   }, 
   "MEDIA":{ 
      "ecr:type":"attributes-owner-folder", 
      "camera.35_mm_camera_lens_equivalent":{ 
         "propertyDataType":"ALPHA", 
         "sourcePropertyNames":[ 
            "camera.35 mm camera lens equivalent" 
         ], 
         "ecr:type":"property" 
      }, 
      "camera.color":{ 
         "isWildcardEnabledInRecordSearch":true, 
         "displayOrder":5, 
         "sourcePropertyNames":[ 
            "camera.Colour of product" 
         ], 
        "isAutogen":true, 
        "isRecordSearchEnabled":true, 
        "ecr:type":"dimension" 
      }, 
      "product.min_price":{ 
         "derivedPropertySource":"product.price", 
         "derivedPropertyFunction":"MIN", 
         "ecr:type":"derived-property" 
      } 
   } 
}
}

You can modify existing configuration or replace it altogether.

To replace the index attributes of a specific owner, use an endpoint of the following form:

PUT http://host:port/ifcr/gsadmin/v1/Discover/attributes/{owner}

For example, the following endpoint replaces the attributes of the "sourceone" owner:

PUT http://host:port/ifcr/gsadmin/v1/Discover/attributes/sourceone

Suppose that a single property attribute, "camera.35_mm_camera_lens_equivalent", is configured for the owner sourceone:

{ 
   "ecr:type": "attributes-owner-folder", 
   "camera.35_mm_camera_lens_equivalent": {
      "ecr:lastModifiedBy": "admin", 
      "propertyDataType": "ALPHA", 
      "sourcePropertyNames": [
         "camera.35 mm camera lens equivalent" 
      ], 
      "ecr:type": "property" 
   } 
}

The following request body updates the configuration belonging to the owner “sourceone” by adding two attributes, “camera.color” and product.max_price“”:

{ 
   "ecr:lastModifiedBy": "admin", 
   "ecr:lastModified": "2016-05-26T14:00:09.764Z", 
   "ecr:createDate": "2016-05-23T11:49:58.144-04:00", 
   "ecr:type": "attributes-owner-folder", 
   "camera.35_mm_camera_lens_equivalent": {
      "ecr:lastModifiedBy": "admin", 
      "propertyDataType": "ALPHA", 
      "ecr:lastModified": "2016-05-26T09:09:04.248-04:00", 
      "sourcePropertyNames": [
         "camera.35 mm camera lens equivalent" 
      ], 
      "ecr:createDate": "2016-05-26T09:09:04.248-04:00", 
      "ecr:type": "property" 
   }, 
   "camera.color": {
      "isWildcardEnabledInRecordSearch": true, 
      "ecr:lastModifiedBy": "admin", 
      "ecr:lastModified": "2016-05-26T09:09:04.248-04:00", 
      "displayOrder": 9, 
      "sourcePropertyNames": [
         "camera.Colour of product" 
      ], 
      "isAutogen": true, 
      "ecr:createDate": "2016-05-26T09:09:04.248-04:00", 
      "isRecordSearchEnabled": true, 
      "ecr:type": "dimension" 
   }, 
   "product.max_price": {
      "derivedPropertySource": "product.price", 
      "ecr:lastModifiedBy": "admin", 
      "ecr:lastModified": "2016-05-26T09:09:04.248-04:00", 
      "derivedPropertyFunction": "MAX", 
      "ecr:createDate": "2016-05-26T09:09:04.248-04:00", 
      "ecr:type": "derived-property" 
   } 
}

 

You can use different endpoints with the GET command to export the following resources from the ECR for viewing:

View a list of all attribute owners

To view a list of the owners of attributes, use the following endpoint:

GET http://host:port/ifcr/gsadmin/v1/Discover/attributes

The following JSON illustrates a possible response returned by the endpoint above when two owners, "sourceone" and "MEDIA", exist:

{ 
   "ecr:lastModifiedBy": "admin", 
   "ecr:lastModified": "2016-05-23T15:49:58.134Z", 
   "ecr:createDate": "2016-05-23T11:06:48.229-04:00", 
   "ecr:type": "attributes-folder", 
   "sourceone": { 
      "ecr:lastModifiedBy": "admin", 
      "ecr:lastModified": "2016-05-26T13:09:22.663Z", 
      "ecr:createDate": "2016-05-23T11:49:58.144-04:00", 
      "ecr:type": "attributes-owner-folder" 
   }, 
   "MEDIA": { 
      "ecr:lastModifiedBy": "admin", 
      "ecr:lastModified": "2016-05-23T11:49:58.146-04:00", 
      "ecr:createDate": "2016-05-23T11:49:58.146-04:00", 
      "ecr:type": "attributes-owner-folder" 
   } 
}


Copyright © Legal Notices