mindnet/tests/ensure_indexes_and_show.py

30 lines
938 B
Python
Raw Normal View History

2025-11-11 17:49:10 +01:00
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
scripts/ensure_indexes_and_show.py
Erzwingt/prüft die Index-Erstellung via ensure_payload_indexes(...) und zeigt danach das payload_schema.
Aufruf:
python3 -m scripts.ensure_indexes_and_show
"""
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)
# Danach anzeigen
notes, chunks, edges = collection_names(cfg.prefix)
cols = [notes, chunks, edges]
res = {}
for name in cols:
info = client.get_collection(collection_name=name)
d = info.dict() if hasattr(info, "dict") else info
res[name] = d.get("result", {}).get("payload_schema")
print(json.dumps(res, ensure_ascii=False, indent=2))
if __name__ == "__main__":
main()