Search and Autocomplete
Search
Perform a personalized, typo-correcting, semantic search.
Syntax
const response = await miso.api.search.search(payload, options);
Payload
TheΒ payload
parameter is an object with the following properties:
Options
TheΒ options
Β parameter is an optional object with the following properties:
Return value
AΒ Promise
Β of response object with the following properties:
Example
const payload = {
user_id: '...',
user_hash: '...',
q: 'doge',
fl: ['title', 'sale_price', 'custom_attributes.*']
};
const { products } = await miso.api.search.search(payload);
For advanced usage, seeΒ REST API.
Autocomplete
Provides real-time, personalized, typo resistant typeahead for your search bar.
Syntax
const response = await miso.api.search.autocomplete(payload, options);
Payload
TheΒ payload
parameter is an object with the following properties:
Options
TheΒ options
Β parameter is an optional object with the following properties:
Return value
AΒ Promise
Β of response object with the following properties:
Example
const payload = {
user_id: '...',
user_hash: '...',
q: 'shiba ',
fl: ['title', 'sale_price'],
completion_fields: ['title', 'tags', 'custom_attributes.author']
};
const { completions } = await miso.api.search.autocomplete(payload);
for (const { text, text_with_markups, product } of completions.title) {
// ...
}
For advanced usage, seeΒ REST API.