mindnet/tests/ensure_indexes_and_show.py

26 lines
964 B
Python
Raw Normal View History

2025-11-11 17:49:10 +01:00
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
2025-11-16 17:36:09 +01:00
tests/ensure_indexes_and_show.py (v1.0)
Alias für die Test-Suite: ruft ensure_payload_indexes(...) auf
und zeigt danach das payload_schema (mit with_payload_schema=True).
2025-11-11 17:49:10 +01:00
"""
from __future__ import annotations
import json
from app.core.qdrant import QdrantConfig, get_client, ensure_payload_indexes, collection_names
def main():
cfg = QdrantConfig.from_env()
client = get_client(cfg)
ensure_payload_indexes(client, cfg.prefix)
notes, chunks, edges = collection_names(cfg.prefix)
res = {}
2025-11-16 17:36:09 +01:00
for name in (notes, chunks, edges):
info = client.get_collection(collection_name=name, with_payload_schema=True)
d = info.model_dump() if hasattr(info, "model_dump") else (info.dict() if hasattr(info, "dict") else info)
res[name] = (d.get("result") or {}).get("payload_schema")
2025-11-11 17:49:10 +01:00
print(json.dumps(res, ensure_ascii=False, indent=2))
if __name__ == "__main__":
main()