trying to impliment a query like this "q": "pizza...
# community-help
a
trying to impliment a query like this "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" current collection schema is this chicken and western are personlized tags {"sku_id": 3778422, "sku_name": "Fish Cutlet (10pcs)", "sku_price": 1300.0, "category_name": "Family Pack", "sku_image": "", "place_id": 42862, "place_name": "Lamprais Corner (Mount Lavinia)", "place_location": [6.8300328, 79.8647537], "portal_status": 1, "merchant_status": 0, "service_group_code": "FOOD_DELIVERY", "rating": 0.0, "no_of_ratings": 0, "top_tags": [], "basic_tag_type": [], "personalized_tags": [], "generic_keywords": [], "chained_tags": [], "tag_ids": "", "popularity": 0.0, "popularity_bin": 0, "hygiene_bin": "0", "aov_bin": "3"} it works fine up until we use grouping but when we include a sorting parameter like the one we have here we are getting an error "results": [ { "code": 400, "error": "Could not parse the filter query." } ] } we might need to add more sorting or filtration potentially request help on why we are getting this error
h
Do you have a
filter_by
in your query?
a
"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" this is the whole query
no filter_by
h
I wouldn't be able to identify the issue from this query alone. Can you provide a reproducible example like: https://gist.github.com/jasonbosco/7c3432713216c378472f13e72246f46b
a
{ "q": "stark", "query_by": "company_name,embedding,country", "exclude_fields": "embedding", "vector_query": "embedding:([], queries:["USA"], ", "sort_by": "num_employees:desc" }
does this work
h
No, I'll need curl commands like the gist example. You don't need to add all of your documents/fields in the example.
a
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" } ] }' | jq % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 100 480 0 70 100 410 693 4062 -- -- -- -- -- -- 4752 { "results": [ { "code": 400, "error": "Could not parse the filter query." } ] }
like this
h
No, a complete example. From collection creation with minimal fields to document indexing and then the query.
a
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" } ] }'
is this okay
test.txt
h
Yes. Can you also open a github issue and mention these steps there? I'll try to reproduce the issue and let you know.
a
okay thanks
🙌🏼 1
hi @Harpreet Sangar is there any update on this
h
Hi @Ahamed Asif I haven't been able to pick up this issue yet. I'll let you know when I do.
a
okay thanks