@attraqt/search
Use @attraqt/search
to search through items using the XO platform.
Installation and Usage
npm install --save @attraqt/search
import { search } from '@attraqt/search';
search.init({
token: 'SEARCH_API_TOKEN'
});
const response = await search.query('T-Shirt', {
offset: 10,
limit: 30,
filter: 'price < 50'
});
console.log(response.items);
console.log(response.metadata);
Methods
Search options
All options are optional.
Option | Type | Description |
---|
limit | number | Pagination: Size of a page |
offset | number | Pagination: Index of the first item to fetch |
filter | string | Filter query string |
sortBy | SortOptions[] | Sort options, evaluated in order of appearance |
facets | FacetRequestOptions[] | Facets filters to apply to the query |
customResponseMask | string | Custom response mask. Allows to fetch only specific field from the catalog |
disable | DisableOptions[] | Features to disable for this query |