A search interface is configured by a JSON document that includes the following elements:
attributes, which configure the behavior of the search interface as a whole. See the following section for information about the attributes of a search interface.
fields, an attribute array containing the members of the search interface. Each member is a dimension or property that is examined for matches with the shopper’s search term. The order of members in the fields array can affect the order of records in search results; see Understand how the fields array affects the sorting of search results.
Search interface attributes
A search interface is configured by JSON attributes. The following table summarizes these attributes. The uses of these attributes are discussed in the sections following this table.
Attribute | Supported values | Description |
---|---|---|
| (required) | Specifies that this JSON document configures a search interface. |
|
| Specifies whether parts of a search term can be individually matched with different members. For example, given the search term “red shoes”, can matches be made between “red” and one member, and between “shoes” and another member? See Examples: cross-field matching and partial matching. Cross field matches can be made between dimensions, between properties, or between dimensions and properties. The possible values of this attribute have the following meanings: |
| Causes the search always to look for matches between members of the search interface and the parts of a search term. Note: If | |
| Requires that the entire search term (that is, all words that the shopper enters to search for) be found within the same member in order to make a match. You can set | |
| Causes the search to look for matches between members of the search interface and parts of a search term only if it cannot match the entire search term to any single member of the search interface. You can set | |
|
| Specifies whether partial query matches should be supported for the search interface that contains this element. See Examples: cross-field matching and partial matching. The possible values of this attribute have the following meanings: |
| A positive integer or zero. If the original keyword search term includes N words, then all results will match at least N – | |
| A positive integer. All results will match at least this many words from the search query. The default is 2. | |
| (required) array of attributes | Each attribute in the The position of the attribute Note: Include |
| positive integer | Specifies the maximum number of words that this member can contain. Omitting this attribute or setting its value to zero disables snippeting. Note: Snippets are useful for document searches, but are not ordinarily used by eCommerce Web sites. |
The following sample JSON illustrates the configuration of a search interface that includes four members, product.displayName
, product.brand
, ecr:crossField
, and product.category
:
{ "ecr:type": "search-interface", "crossFieldMatch": "always", "fields": [ { "attribute": "product.displayName " }, { "attribute": "product.brand" }, { "attribute": "ecr:crossField" }, { "attribute": "product.category" } ] }