Vamshi Aruru
10/24/2024, 7:30 AMcurl -X POST '<http://localhost:8108/collections>' \
-H 'X-Typesense-Api-Key: xyz' \
-H 'Content-Type: application/json' \
-d '{
"name": "product_variant",
"fields": [
{"name": "id", "type": "string", "index": true},
{"name": "productId", "type": "string", "facet": true},
{"name": "productSlug", "type": "string", "index": true},
{"name": "variantID", "type": "string","sort": true},
{"name": "enabled", "type": "string", "index": true},
{"name": "title", "type": "string", "index": true}
]
}'
Collection documents:
curl -X POST '<http://localhost:8108/collections/product_variant/documents/import>' \
-H 'X-Typesense-Api-Key: xyz' \
-H 'Content-Type: application/jsonl' \
-d '{"id": "1","productId": "1","productSlug": "slug1", "variantID": "v1", "enabled": "Yes", "title": "Nirlon Cast Iron Dosa Tawa - 12 Inches"}
{"id": "2","productId": "1","productSlug": "slug1", "variantID": "v2", "enabled": "No", "title": "Tarami Ethnic Bedsheet - Green"}
{"id": "3","productId": "2","productSlug": "slug2", "variantID": "v3", "enabled": "Yes", "title": "Nirlon Orange Non Stick Dosa Tawa - 11 Inches"}
{"id": "4","productId": "3","productSlug": "slug3", "variantID": "v4", "enabled": "Yes", "title": "Nirlon Orange Non Stick Dosa Tawa - 10 Inches"}'
Search call with pinned hits that gives only one result:
curl --location '<http://localhost:8108/collections/product_variant/documents/search?pinned_hits=2%3A1&q=dasa&query_by=title&filter_curated_hits=true&typo_tokens_threshold=10>' \
--header 'x-typesense-api-key: xyz'
Search call without pinned hits that gives the actual results:
curl --location '<http://localhost:8108/collections/product_variant/documents/search?q=dasa&query_by=title&filter_curated_hits=true&typo_tokens_threshold=10>' \
--header 'x-typesense-api-key: xyz'
If you can confirm that I am not doing anything wrong here, I can raise an issue on github.