"""Things I wanted to verify: unindexed filters, text match, and index timing."""
from qdrant_client import QdrantClient, models
from common import COLLECTION

client = QdrantClient(url="http://localhost:6333")
heading = models.Filter(must=[models.FieldCondition(key="heading", match=models.MatchValue(value="Cancel job"))])
print("unindexed field 'heading' == 'Cancel job':", client.count(COLLECTION, count_filter=heading, exact=True).count)
txt = models.Filter(must=[models.FieldCondition(key="text", match=models.MatchText(text="webhook"))])
print("MatchText 'webhook' without text index:", client.count(COLLECTION, count_filter=txt, exact=True).count)
client.create_payload_index(COLLECTION, "text", models.TextIndexParams(type="text", tokenizer=models.TokenizerType.WORD, lowercase=True))
print("MatchText 'webhook' with text index:", client.count(COLLECTION, count_filter=txt, exact=True).count)
client.delete_payload_index(COLLECTION, "text")
print("payload_schema:", {k: v.data_type.value for k, v in client.get_collection(COLLECTION).payload_schema.items()})
