Arguments:
request.q
required (string): Search query.
request.offset
optional (number): Offset of products items. Used in pagination.
request.limit
optional (number): Number of products in result.
request.filters
optional (filter[]): Array of selected filters.
request.sort
optional (sort[]): Array of selected sortings.
request.user
optional (user): User object. Could be provided either at initialization or at request.
Types
filter.name
required (string): Name of filter.
filter.type
required (string): Type of filter.
filter.values
optional (object[]): Array of selected filter values.
filter.values[].value
optional (string): Selected filter value.
filter.values[].from
optional (string): Selected range filter "from" value.
filter.values[].to
optional (string): Selected range filter "to" value.
sort.field
required (string): Field for sorting.
sort.order
required ('desc' || 'asc'): Sorting order.
user.uid
required (string): Unique customer id.
user.sid
required (string): Session id.
user.email
optional (string): Customer email.
user.ip
optional (number): Customer ip.
user.ua
optional (string): Customer user agent.
user.lang
optional (string[]): Languages.
Returns:
Search results with products list, selected facets list and meta data. If banner or redirect was configured for this query it will be in this response as well.
Examples of usage:
var request = {
q: 'White shirt',
offset: 20,
limit: 15,
filters: [{
name: 'category1',
type: 'category',
values: [{
value: 'T-Shirts'
}]
}],
sort: [{
field: 'price',
order: 'asc'
}]
};
client.search(request).then(function(response) {
// handle search response
});