LightRAG/lightrag/kg
BukeLy e24b2ed4fa fix: Prioritize workspace-specific legacy collections in Qdrant migration
Why this change is needed:
The E2E test test_backward_compat_old_workspace_naming_qdrant was failing
because _find_legacy_collection() searched for generic "lightrag_vdb_{namespace}"
before workspace-specific "{workspace}_{namespace}" collections. When both
existed, it would always find the generic one first (which might be empty),
ignoring the workspace collection that actually contained the data to migrate.

How it solves it:
Reordered the candidates list in _find_legacy_collection() to prioritize
more specific naming patterns over generic ones:
  1. {workspace}_{namespace}  (most specific, old workspace format)
  2. lightrag_vdb_{namespace}  (generic legacy format)
  3. {namespace}  (most generic, oldest format)

This ensures the migration finds the correct source collection with actual data.

Impact:
- Fixes test_backward_compat_old_workspace_naming_qdrant which creates
  a "prod_chunks" collection with 10 points
- Migration will now correctly find and migrate from workspace-specific
  legacy collections before falling back to generic collections
- Maintains backward compatibility with all legacy naming patterns

Testing:
Run: pytest tests/test_e2e_multi_instance.py::test_backward_compat_old_workspace_naming_qdrant -v
2025-11-20 02:34:55 +08:00
..
deprecated Preserve ordering in get_by_ids methods across all storage implementations 2025-10-11 12:37:59 +08:00
__init__.py Improve storage config validation and add config.ini fallback support 2025-11-08 22:48:49 +08:00
faiss_impl.py Remove final_namespace attribute for in-memory storage and use namespace in clean_llm_query_cache.py 2025-11-17 12:54:33 +08:00
json_doc_status_impl.py Remove final_namespace attribute for in-memory storage and use namespace in clean_llm_query_cache.py 2025-11-17 12:54:33 +08:00
json_kv_impl.py Remove final_namespace attribute for in-memory storage and use namespace in clean_llm_query_cache.py 2025-11-17 12:54:33 +08:00
memgraph_impl.py Refactor workspace handling to use default workspace and namespace locks 2025-11-17 12:54:33 +08:00
milvus_impl.py Standardize empty workspace handling from "_" to "" across storage 2025-11-17 12:54:33 +08:00
mongo_impl.py Standardize empty workspace handling from "_" to "" across storage 2025-11-17 12:54:33 +08:00
nano_vector_db_impl.py Standardize empty workspace handling from "_" to "" across storage 2025-11-17 12:54:33 +08:00
neo4j_impl.py Refactor workspace handling to use default workspace and namespace locks 2025-11-17 12:54:33 +08:00
networkx_impl.py Remove final_namespace attribute for in-memory storage and use namespace in clean_llm_query_cache.py 2025-11-17 12:54:33 +08:00
postgres_impl.py fix: use actual embedding_dim instead of environment variable 2025-11-20 02:17:17 +08:00
qdrant_impl.py fix: Prioritize workspace-specific legacy collections in Qdrant migration 2025-11-20 02:34:55 +08:00
redis_impl.py Standardize empty workspace handling from "_" to "" across storage 2025-11-17 12:54:33 +08:00
shared_storage.py style: fix lint errors (trailing whitespace and formatting) 2025-11-20 01:41:23 +08:00