Spaces:
Sleeping
Sleeping
one collection
Browse files- core/collection_utils.py +7 -4
core/collection_utils.py
CHANGED
|
@@ -14,10 +14,13 @@ def normalize_folder_key(folder_key: str) -> str:
|
|
| 14 |
|
| 15 |
|
| 16 |
def build_collection_name(folder_key: str, prefix: str = "rag") -> str:
|
| 17 |
-
|
| 18 |
-
|
| 19 |
-
|
| 20 |
-
|
|
|
|
|
|
|
|
|
|
| 21 |
|
| 22 |
|
| 23 |
def extract_year_tokens(value: str) -> Set[str]:
|
|
|
|
| 14 |
|
| 15 |
|
| 16 |
def build_collection_name(folder_key: str, prefix: str = "rag") -> str:
|
| 17 |
+
"""
|
| 18 |
+
OPTIMIZED: Always return single collection name regardless of folder_key.
|
| 19 |
+
This ensures all documents go into ONE collection for deduplication and efficient querying.
|
| 20 |
+
Folder structure is preserved in payload metadata (folder_key), not as separate collections.
|
| 21 |
+
"""
|
| 22 |
+
# ✅ Force single collection: always return "rag_docs"
|
| 23 |
+
return f"{prefix}_docs"
|
| 24 |
|
| 25 |
|
| 26 |
def extract_year_tokens(value: str) -> Set[str]:
|