updated search suggestions functionality
This commit is contained in:
@@ -179,8 +179,15 @@ export const api = {
|
||||
getProductDetail: (brand, imageId) =>
|
||||
request(`/api/brands/${encodeURIComponent(brand)}/products/${encodeURIComponent(imageId)}`),
|
||||
|
||||
search: (q, { brand, category, top_k = 50 } = {}) =>
|
||||
request(`/api/search${qs({ q, brand, category, top_k })}`),
|
||||
// Same reasoning as SHOW_ALL_PRODUCTS_LIMIT above: searching a brand name must
|
||||
// return that brand's whole catalog, not a page of it. The old default of 50
|
||||
// was in any case ignored - the backend clamped every search to 15.
|
||||
search: (q, { brand, category, top_k = SHOW_ALL_PRODUCTS_LIMIT, offset = 0 } = {}) =>
|
||||
request(`/api/search${qs({ q, brand, category, top_k, offset })}`),
|
||||
|
||||
// Autocomplete for the catalog search box. Answers from in-process caches,
|
||||
// so it is safe to call per keystroke (debounced in useSuggestions).
|
||||
suggest: (q, { limit = 8 } = {}) => request(`/api/suggest${qs({ q, limit })}`),
|
||||
|
||||
chat: ({ query, brand, category, top_k, history }) =>
|
||||
request('/api/chat', {
|
||||
|
||||
Reference in New Issue
Block a user