curl "
http://localhost:8108/collections" \
-X POST \
-H "X-TYPESENSE-API-KEY: xyz" \
-H "Content-Type: application/json" \
-d '{
"name": "Prod_sku_collection_test2",
"fields": [
{ "name": "sku_id", "type": "int32", "facet": false, "index": true, "sort": true, "store": true },
{ "name": "sku_name", "type": "string", "facet": false, "index": true, "store": true },
{ "name": "sku_price", "type": "float", "facet": false, "index": true, "sort": true, "store": true },
{ "name": "category_name", "type": "string", "facet": true, "index": true, "store": true },
{ "name": "image", "type": "string", "facet": false, "optional": true, "index": true, "store": true },
{ "name": "place_id", "type": "int32", "facet": true, "index": true, "sort": true, "store": true },
{ "name": "place_name", "type": "string", "facet": true, "index": true, "store": true },
{ "name": "place_location", "type": "geopoint", "facet": true, "index": true, "sort": true, "store": true },
{ "name": "portal_status", "type": "int32", "facet": false, "index": true, "sort": true, "store": true },
{ "name": "merchant_status", "type": "int32", "facet": false, "index": true, "sort": true, "store": true },
{ "name": "service_group_code", "type": "string", "facet": true, "index": true, "store": true },
{ "name": "rating", "type": "float", "facet": false, "index": true, "sort": true, "store": true },
{ "name": "no_of_ratings", "type": "int32", "facet": false, "index": true, "sort": true, "store": true },
{ "name": "top_tags", "type": "string[]", "facet": true, "index": true, "store": true },
{ "name": "basic_tag_type", "type": "string[]", "facet": true, "index": true, "store": true },
{ "name": "personalized_tags", "type": "string[]", "facet": true, "index": true, "store": true },
{ "name": "generic_keywords", "type": "string[]", "facet": true, "index": true, "store": true },
{ "name": "chained_tags", "type": "string[]", "facet": true, "index": true, "store": true },
{ "name": "tag_ids", "type": "string", "facet": false, "index": true, "store": true },
{ "name": "popularity", "type": "float", "facet": false, "index": true, "sort": true, "store": true },
{ "name": "popularity_bin", "type": "int32", "facet": true, "index": true, "sort": true, "store": true },
{ "name": "hygiene_bin", "type": "string", "facet": true, "index": true, "store": true },
{ "name": "aov_bin", "type": "string", "facet": true, "index": true, "store": true },
{
"name": "embedding",
"type": "float[]",
"index": true,
"num_dim": 384,
"vec_dist": "cosine",
"store": true,
"embed": {
"from": ["sku_name", "category_name", "basic_tag_type", "personalized_tags", "generic_keywords"],
"model_config": { "model_name": "ts/all-MiniLM-L12-v2" }
},
"hnsw_params": { "M": 16, "ef_construction": 200 }
}
]
}' curl -s "$TYPESENSE_HOST/collections/Prod_sku_collection_test2/documents/import?action=create" \
-H "X-TYPESENSE-API-KEY: ${TYPESENSE_API_KEY}" \
-H "Content-Type: text/plain" \
-X POST \
-d '{"sku_id": 8247947, "sku_name": "Curry Chicken Pizza (Regular)", "sku_price": 699.0, "category_name": "SMART SAVER PIZZA - REGULAR", "sku_image": "", "place_id": 49255, "place_name": "Dominos Pizza (Union Place)", "place_location": [6.9179096, 79.863472], "portal_status": 1, "merchant_status": 1, "service_group_code": "FOOD_DELIVERY", "rating": 100.0, "no_of_ratings": 6, "top_tags": [], "basic_tag_type": ["Pizza"], "personalized_tags": ["Chicken", "Italian"], "generic_keywords": ["Chicken Pizza", "Curry Chicken Pizza", "Pizza"], "chained_tags": ["Dominos Pizza"], "tag_ids": "", "popularity": 0.0, "popularity_bin": 0, "hygiene_bin": "0", "aov_bin": "2"}
{"sku_id": 8247948, "sku_name": "Chicken Keema Pizza (Regular)", "sku_price": 699.0, "category_name": "SMART SAVER PIZZA - REGULAR", "sku_image": "", "place_id": 49255, "place_name": "Dominos Pizza (Union Place)", "place_location": [6.9179096, 79.863472], "portal_status": 1, "merchant_status": 1, "service_group_code": "FOOD_DELIVERY", "rating": 100.0, "no_of_ratings": 6, "top_tags": [], "basic_tag_type": ["Pizza"], "personalized_tags": ["Chicken", "Italian"], "generic_keywords": ["Chicken Keema Pizza", "Chicken Pizza", "Pizza"], "chained_tags": ["Dominos Pizza"], "tag_ids": "", "popularity": 0.0, "popularity_bin": 0, "hygiene_bin": "0", "aov_bin": "2"}
{"sku_id": 8247949, "sku_name": "Hot & Sweet Chicken Pizza (Regular)", "sku_price": 699.0, "category_name": "SMART SAVER PIZZA - REGULAR", "sku_image": "", "place_id": 49255, "place_name": "Dominos Pizza (Union Place)", "place_location": [6.9179096, 79.863472], "portal_status": 1, "merchant_status": 1, "service_group_code": "FOOD_DELIVERY", "rating": 92.9, "no_of_ratings": 7, "top_tags": [], "basic_tag_type": ["Pizza"], "personalized_tags": ["Chicken", "Italian"], "generic_keywords": ["Chicken Pizza", "Hot and Sweet Chicken Pizza", "Pizza", "Teriyaki Chicken Pizza"], "chained_tags": ["Dominos Pizza"], "tag_ids": "", "popularity": 0.0, "popularity_bin": 0, "hygiene_bin": "0", "aov_bin": "2"}
{"sku_id": 8247950, "sku_name": "Curry Chicken Pizza (Medium)", "sku_price": 1499.0, "category_name": "SMART SAVER PIZZA - MEDIUM", "sku_image": "", "place_id": 49255, "place_name": "Dominos Pizza (Union Place)", "place_location": [6.9179096, 79.863472], "portal_status": 1, "merchant_status": 1, "service_group_code": "FOOD_DELIVERY", "rating": 100.0, "no_of_ratings": 6, "top_tags": [], "basic_tag_type": ["Pizza"], "personalized_tags": ["Chicken", "Italian"], "generic_keywords": ["Chicken Pizza", "Curry Chicken Pizza", "Pizza"], "chained_tags": ["Dominos Pizza"], "tag_ids": "", "popularity": 0.0, "popularity_bin": 0, "hygiene_bin": "0", "aov_bin": "2"}
{"sku_id": 8247951, "sku_name": "Chicken Keema Pizza (Medium)", "sku_price": 1499.0, "category_name": "SMART SAVER PIZZA - MEDIUM", "sku_image": "", "place_id": 49255, "place_name": "Dominos Pizza (Union Place)", "place_location": [6.9179096, 79.863472], "portal_status": 1, "merchant_status": 1, "service_group_code": "FOOD_DELIVERY", "rating": 100.0, "no_of_ratings": 6, "top_tags": [], "basic_tag_type": ["Pizza"], "personalized_tags": ["Chicken", "Italian"], "generic_keywords": ["Chicken Keema Pizza", "Chicken Pizza", "Pizza"], "chained_tags": ["Dominos Pizza"], "tag_ids": "", "popularity": 0.0, "popularity_bin": 0, "hygiene_bin": "0", "aov_bin": "2"}' | jq
curl "
http://localhost:8108/multi_search" \
-X POST \
-H "X-TYPESENSE-API-KEY: xyz" \
-H "Content-Type: application/json" \
-d '{
"searches": [
{
"collection": "Prod_sku_collection_test2",
"q": "pizza",
"query_by": "sku_name,embedding,category_name,basic_tag_type",
"exclude_fields": "embedding",
"vector_query": "embedding:([], queries:[\"chicken\",\"western\"], query_weights:[0.5,0.5])",
"group_by": "place_name,chained_tags",
"sort_by": "rating:desc"
}
]
}'