Shmuly Itzkowitz
03/27/2025, 5:11 PMconst semanticSearchParams = {
collection: 'products',
q: 'sku, product_name, description', // Use the search term from the search bar
query_by: 'sku,product_name,description',
query_by_weights: '8,4,2', // Prioritize product_name over SKU and description
prioritize_exact_match: true,
prefix: true, // Enables partial matching
drop_tokens_threshold: 1, // Allows partial word matches
sort_by: sort_by_value, // Ensures keyword matches come first
vector_query: `embedding:([${queryVector}], k:100, distance_threshold:0.6, alpha:0.7)`,
exclude_fields: 'embedding',
max_facet_values: 200,
facet_return_parent: 'collections.id, brand.id',
facet_by: 'collections.id, brand.id',
group_by: 'parent_id',
group_limit: 1,
page,
per_page: perPage, // Default to 6 results per page if not provided
filter_by: filterQuery,
};
Jason Bosco
03/27/2025, 8:16 PMShmuly Itzkowitz
03/27/2025, 8:19 PM