Skip to main content

searchProduct

Quick search for page objects with limited output

Products.searchProduct(name, langCode)

const value = await Products.searchProduct('cup')
Schema

name:* string
Text to search product page objects (search is based on the title field of the localizeInfos object with language consideration)
example: cup

langCode: string
Language code. Default "en_US"
example: en_US

This method performs a quick search for product page objects based on a text query name. The search is performed on the title field of the localizeInfos object, taking the specified lang language code into consideration. It returns a Promise that resolves to an array of indexed Product objects.

Example return:

[
{
"id": 4,
"localizeInfos": {
"title": "Cosmo"
},
"statusIdentifier": null,
"statusLocalizeInfos": {},
"attributeSetIdentifier": "products",
"position": 1,
"templateIdentifier": null,
"isPositionLocked": false,
"shortDescTemplateIdentifier": null,
"price": 150,
"additional": {
"prices": {
"min": 120,
"max": 150
}
},
"sku": null,
"isSync": true,
"attributeValues": {
"price": {
"type": "integer",
"value": "150",
"position": 1,
"isProductPreview": false
},
"product-name": {
"type": "string",
"value": "Cosmo",
"position": 0,
"isProductPreview": false
},
"currency_products": {
"type": "string",
"value": "",
"position": 2,
"isProductPreview": false
}
},
"isVisible": true,
"productPages": {
"id": 6,
"pageId": 2,
"productId": 4,
"positionId": 229
},
"blocks": "product_block"
}
]
Schema

id: number
object identifier
example: 1764

additional: Record<string, any>
additional value from the index
example:

{
"prices": {
"min": 0,
"max": 100
}
}

statusLocalizeInfos: CommonLocalizeInfos
json description of the item status object, taking into account the language
example:

{
"title": "Product"
}

localizeInfos: Record<string, any>
json description of the main page data object taking into account the language "en_US" (for example)
example:

{
"en_US": {
"title": "Catalog",
"plainContent": "Content for catalog",
"htmlContent": "<b>Content for catalog</b>",
"menuTitle": "Catalog"
}
}

isVisible: boolean
Page visibility flag
example: true

position: number
position number (for sorting)
example: 192

templateIdentifier: string
custom identifier of the associated template
example: my-template

attributeSetId: number
attribute set identifier
example: 7

blocks: array
product blocks
example:

["product_block"]

isSync: boolean
indicator of page indexing (true or false)
example: false

attributeValues: Record<string, string>
Array of attribute values from the index (presented as a pair of custom attribute identifier: attribute value)
example:

{
"en_US": {
"marker": {
"value": "",
"type": "string"
}
}
}

statusId: number
status identifiers of the product page (can be null)
example: 1

sku: string
product SKU value taken from the index
example: 1

relatedIds: array
identifiers of related product pages
example:

[ 1, 2, 3 ]

price: number
price value of the product page taken from the index
example: 0

templateIdentifier string
custom identifier of the associated template
example: my-template

shortDescTemplateIdentifier string
custom identifier of the associated template for short description
example: my-template-short