| 1234567891011121314151617181920212223 |
- # check_weaviate.py
- from src.weaviate_client import WeaviateClient
- import sys
- sys.path.insert(0, './src')
- client = WeaviateClient()
- collection = client.client.collections.get("ScientificArticle")
- # Loendi kokku
- count_response = collection.aggregate.over_all(total_count=True)
- total = count_response.total_count
- print(f"\n✅ Weaviate'is on {total} artiklit.")
- # Võta mõni näidis välja
- if total > 0:
- print("\n📄 Esimesed 3 artiklit:")
- response = collection.query.fetch_objects(limit=3)
- for i, obj in enumerate(response.objects):
- print(f"\n{i+1}. ID: {obj.properties.get('article_id', 'N/A')}")
- print(f" Pealkiri: {obj.properties.get('title', 'N/A')}")
- print(f" Autorid: {obj.properties.get('authors', ['N/A'])}")
- client.close()
|