Attributes
Structure
The attribute field is an array of JSON elements. Each attribute must declare the following fields.
type
type as string
yes
See available types below
localizedNames
list
no
List of objects providing available translations per locale:
{
"locale": "<langcode_countrycode>",
"name": "<translation>"
}
isRequired
Boolean
no
The attribute is required or not on item creation
isReturned
Boolean
no
XO configuration
isIndexed
Boolean
no
XO configuration
isExported
Boolean
no
XO configuration
attributes
list
yes if type is Object or ObjectList
type of elements in object
listSubType
Boolean
yes if type is List
type of elements in list
isFhrValue
Boolean
no
Define if the attribute is related to the FHR Value attribute
isFhrValueId
Boolean
no
Define if the attribute is related to FHR Value Id attribute
Attributes name can be freely defined _**_but certain attributes are reserved for use.
Available types
Name
Description
BOOLEAN
true/false
FLOAT
Floating numbers
INTEGER
Integer numbers
TEXT
String
TIMESTAMP
LIST
List of values, each value with the same type
OBJECT
Key value object, where each value as its own schema.
OBJECTLIST
List of objects (only object of the same schema are allowed)
LOCALIZEDTEXT
Key value object (see below)
Localized Text
The LOCALIZEDTEXT type allows you to add translations to the given field defined in the attributes. It's a key-value object where:
key is based on the Java locale format <languagecode>_<countrycode>
languagecode is based on the ISO 639-1
countrycode is defined by ISO 3166-1
values are strings
Let's say that the title
field of your item has a French and German translation:
LOCALIZEDTEXT can be used where text fields are available (as is, in a LIST, in an OBJECT or OBJECTLIST)
XO features (recommendation, product tagging) need a default locale to work. This default locale must be set in this api.
Type decision tree
FHR data modeling
To make use of FHR specific features refer to below table on how to model item's attributesype
BOOLEAN
Flag out of stock or on sale items.
Implicitly converted to INTEGER, False - 0, True - 1
INTEGER
For (bracketed) facets and sorting on e.g. stock amounts, ratings, etc.
Only positive integer values are allowed.
FLOAT
Typically used for bracketed facets and sorting on prices, margin, discounts etc.
Only positive float values are allowed. Negative values will be considered as undefined.
TEXT
Not multi lingual but possible to navigate on. It is typically used for product codes that are locale independent and need to be displayed or free text searchable
Data type without locale specific values, i.e. its value is the same across all locales.
TIMESTAMP
Same as text
Implicitly converted to TEXT.
LOCALIZEDTEXT
Meant for free text search and display purposes. Typical examples of this are product descriptions or image references.
An asset value does not have a locale independent identifier. It is not possible to create facets or sort on assets
LIST
Used exclusively for providing product item's categorization (categories attribute) as list of leaf category ids the item belongs to.
Not multi lingual, any other attribute of the type is implicitly converted to OBJECTLIST where each value is made available for all catalog localizations.
OBJECT
Typically used for facets. One value per item.
Represents fixed list of multi-lingual, locale dependent display values (values property) sharing the same locale independent value identifier (value_id property). Identifiers should be unique to the attribute and can contain only characters a-z0-9 and "_".
OBJECTLIST
Typically used for facets. Multiple values per item.
The type specifics are identical to OBJECT.
FHR functionality matrix
The following table provides an overview of some FHR functionalities and how each types can be used for that:
BOOLEAN
β
β
β
β
β
β
INTEGER
β
β
β
β
β
β
FLOAT
β
β
β
β
β
β
TEXT
β
β
β
β
β
β
TIMESTAMP
β
β
β
β
β
β
LOCALIZEDTEXT
β
β
β
β
β
β
LIST
β
β*
β
β
β
β
OBJECT
β
β
β
β
β
β
OBJECTLIST
β
β
β
β
β
β
* Not applicable for categories attribute.
FHR Object Type
To work with attribute type "Object" with FHR, the object's attribute must have one attribute with the isFhrValue
flag and one with the isFhrValueId
flag.
The flags are automatically set if your schema is following this structure:
Examples
Here is an example of item schema with one field of each type:
OBJECT and OBJECTLIST types allow recursive typing:
Validation
Additional validation:
each attribute (and attributes of inner schemas) should have unique attribute names
the following attributes name are reserved and cannot be used : "secondid", "universe", "countries", "itemid", "match_rate", "categories"
FHR data model validation
The query parameter fhrValidation=true can be added to enforces Fredhopper specific validation to the schema API. This includes the following additional checks to the schema:
Attribute name (aka attribute_ids) are lowercased with only [a-z0-9_]+ i.e. lowercase Latin letters:
a-z
, digits:0-9
, and underscores:_
Value (type TEXT) and value_id (type TEXT or LOCALIZEDTEXT) are mandatory for attributes of type OBJECT and OBJECTLIST
Attribute name (aka attribute_ids) cannot start with a number
FHR valid types for attributes are : βbooleanβ, βtextβ, βintegerβ, βfloatβ, βlistβ, βlocalizedTextβ, βObjectβ, βObjectListβ, βtimestampβ
Last updated