Searchability Configuration
The searchabilities API endpoints allow customers to customize the product data that are searched by Krestor, such as by making a brand or color facet searchable.
Scope
Merchants can configure the searchability statuses of each field of their product catalog.
Additional information
Searchability configurations are refreshed during ingestion of product updates. Searchability configurations for fields which no longer exist in the catalog will be maintained in the event a field was removed from the feed momentarily by mistake. We support ingestion of nested searchabilities too and they are defined in the metadata fields of each product like so:
{
"facet": {
"color": "red"
}
}
facet.color
would be a generated searchable configuration in this case.
Creating new searchabilities
When new searchability configurations are defined based on a field being added to the catalog, they are disabled by default
(i.e. their exact_searchable
and fuzzy_searchable
fields will be set to false).
When retrieved using the retrieve searchabilities endpoint,
date of creation for the searchability configuration (when the field was first added to the
catalog or the searchability configuration was created manually) will be reflected in the
created_at
field. On the other hand, updated_at
field will reflect the date when searchability configuration was last modified.
Updates to search results
When new searchability configurations are created or updated, they will only take effect when the search index is updated.
Searchability concepts
- Exact searchable Only queries with the same spelling and/or stemming as the value(s) in the field should be considered a match.
- Fuzzy searchable Queries with misspelling or different stemming compared to the value(s) in the field should be considered a match.
Retrieve searchabilities
This endpoint is used to retrieve all searchability configurations or configurations with a given name. If no searchability name is provided, all field searchability configurations will be returned. Otherwise, only the searchability configuration with the given name will be returned.
- Shell
- JavaScript
- Python
- Java
- iOS
- Android
- C#
curl -X GET -H "Content-Type: application/json" \
-u"[your token]:" "https://ac.cnstrc.com/v1/searchabilities?key=[your API key]"
curl -X GET -H "Content-Type: application/json" \
-u"[your token]:" "https://ac.cnstrc.com/v1/searchabilities/size?key=[your API key]"
// This method is not currently supported.
# This method is not currently supported.
// This method is not currently supported.
// This method is not currently supported.
// This method is not currently supported.
// This method is not currently supported.
info
The above command returns a 200 Success response on success.
HTTP Request
GET https://ac.cnstrc.com/v1/searchabilities?key=[your API key]
GET https://ac.cnstrc.com/v1/searchabilities/[name]?key=[your API key]
GET https://ac.cnstrc.com/v1/searchabilities?key=[your API key]&filters[exact_searchable]=true
GET https://ac.cnstrc.com/v1/searchabilities?key=[your API key]&searchable=true&sort_by=[sort_by]&sort_order=[sort_order]
Response format
{
"searchabilities": [
{
"name": "on_sale",
"fuzzy_searchable": true,
"exact_searchable": false,
"type": "string",
"displayable": true,
"hidden": false,
"created_at": "2019-04-12T18:15:30",
"updated_at": "2019-04-12T18:15:30"
},
{
"name": "keywords",
"fuzzy_searchable": false,
"exact_searchable": true,
"type": "string",
"displayable": false,
"hidden": false,
"created_at": "2020-04-12T18:15:30",
"updated_at": "2020-04-12T18:15:30"
}
],
"total_count": 2
}
Query Parameters
Parameter | Required? | Description |
---|---|---|
name | No | Name of searchability field. |
page | No | The page number of the results. Defaults to 1. Can't be used together with 'offset' |
offset | No | The number of results to skip from the beginning. Can't be used together with 'page' |
num_results_per_page | No | The number of searchability configurations to return. Defaults to 100. |
filters | No | Filters the results based on name , exact_searchable or fuzzy_searchable . |
searchable | No | Retrieves only results which are either exact_searchable or fuzzy_searchable . |
sort_by | No | The criteria by which searchability configurations should be sorted. Defaults to no sorting. Valid criteria is name . |
sort_order | No | Either descending or ascending . The sort order by which searchability configurations should be sorted. Only valid in conjunction with sort_by . |
Patch searchabilities
Patching searchabilities will only change the searchability configurations that are specified in the request.
- Shell
- JavaScript
- Python
- Java
- iOS
- Android
- C#
curl -X PATCH -H "Content-Type: application/json" \
-d '{
"searchabilities": [
{
"name": "style_id",
"exact_searchable": "true"
},
{
"name": "keywords",
"fuzzy_searchable": "true"
},
]
}' \
-u"[your token]:" "https://ac.cnstrc.com/v1/searchabilities?key=[your index key]§ion=Products"
// This method is not currently supported.
# This method is not currently supported.
// This method is not currently supported.
// This method is not currently supported.
// This method is not currently supported.
// This method is not currently supported.
info
The above command returns a 204 Success response on success. For simplicity sake, a 204 Success response will be returned even if the item already exists.
HTTP Request
PATCH https://ac.cnstrc.com/v1/searchabilities?key=[your index key]§ion=[section]
URL Parameters
Parameter | Required? | Description |
---|---|---|
section | Yes | The index section for which you'd like to patch searchability configurations (typically Products ). |
JSON Specifications
{
"searchabilities": [
{
"name": "keywords",
"fuzzy_searchable": true,
"exact_searchable": false,
"displayable": false
"hidden": false
}
]
}
Parameters
Parameter | Required? | Description |
---|---|---|
displayable | No | Specifies whether the field is displayable in the response within the results array. |
hidden | No | Hides the field by default in the response but makes it available to retrieve via fmt_options[hidden_fields] parameter |
exact_searchable | No | Terms can be exact searchable (either exact_searchable or fuzzy_searchable fields can be true , but not both). |
fuzzy_searchable | No | Terms can be fuzzy searchable (either exact_searchable or fuzzy_searchable fields can be true , but not both). |
name | Yes | Name of searchability field. |
Patch single searchability
Patching a searchability will only change the searchability configuration for the field specified in the url.
- Shell
- JavaScript
- Python
- Java
- iOS
- Android
- C#
curl -X PUT -H "Content-Type: application/json" \
-d '{
"displayable": "true",
"hidden": "false",
"exact_searchable": "true",
"fuzzy_searchable": "false"
}' \
-u"[your token]:" "https://ac.cnstrc.com/v1/searchabilities/keywords?key=[your index key]§ion=Products"
// This method is not currently supported.
# This method is not currently supported.
// This method is not currently supported.
// This method is not currently supported.
// This method is not currently supported.
// This method is not currently supported.
info
The above command returns a 200 Success response on success.
HTTP Request
PATCH https://ac.cnstrc.com/v1/searchabilities/[name]?key=[your index key]§ion=[section]
URL Parameters
Parameter | Required? | Description |
---|---|---|
section | Yes | The index section for which you'd like to patch searchability configuration (typically Products ). |
name | Yes | Name of searchability field. |
JSON Specifications
{
"displayable": true,
"hidden": false,
"fuzzy_searchable": true,
"exact_searchable": false
}
Parameters
Parameter | Required? | Description |
---|---|---|
displayable | No | Specifies whether the field is displayable in the response within the results array. |
hidden | No | Hides the field by default in the response but makes it available to retrieve via fmt_options[hidden_fields] parameter |
exact_searchable | No | Terms can be exact searchable (either exact_searchable or fuzzy_searchable fields can be true , but not both). |
fuzzy_searchable | No | Terms can be fuzzy searchable (either exact_searchable or fuzzy_searchable fields can be true , but not both). |