ragflow/api/db
hsparks.codes d104f59e29 feat: Implement hierarchical retrieval architecture (#11610)
This PR implements the complete three-tier hierarchical retrieval architecture
as specified in issue #11610, enabling production-grade RAG capabilities.

## Tier 1: Knowledge Base Routing
- Auto-route queries to relevant knowledge bases
- Per-KB retrieval parameters (KBRetrievalParams dataclass)
- Rule-based routing with keyword overlap scoring
- LLM-based routing with fallback to rule-based
- Configurable routing methods: auto, rule_based, llm_based, all

## Tier 2: Document Filtering
- Document-level metadata filtering within selected KBs
- Configurable metadata fields for filtering
- LLM-generated filter conditions
- Metadata similarity matching (fuzzy matching)
- Enhanced metadata generation for documents

## Tier 3: Chunk Refinement
- Parent-child chunking with summary mapping
- Custom prompts for keyword extraction
- LLM-based question generation for chunks
- Integration with existing retrieval pipeline

## Metadata Management (Batch CRUD)
- MetadataService with batch operations:
  - batch_get_metadata
  - batch_update_metadata
  - batch_delete_metadata_fields
  - batch_set_metadata_field
  - get_metadata_schema
  - search_by_metadata
  - get_metadata_statistics
  - copy_metadata
- REST API endpoints in metadata_app.py

## Integration
- HierarchicalConfig dataclass for configuration
- Integrated into Dealer class (search.py)
- Wired into agent retrieval tool
- Non-breaking: disabled by default

## Tests
- 48 unit tests covering all components
- Tests for config, routing, filtering, and metadata operations
2025-12-09 07:32:00 +01:00
..
joint_services Move api.settings to common.settings (#11036) 2025-11-06 09:36:38 +08:00
services feat: Implement hierarchical retrieval architecture (#11610) 2025-12-09 07:32:00 +01:00
__init__.py Fix: GraphRAG and RAPTOR tasks do not affect document status (#11194) 2025-11-12 12:03:41 +08:00
db_models.py Feat: RAG evaluation (#11674) 2025-12-03 17:00:58 +08:00
db_utils.py Add time utils (#10849) 2025-10-28 19:09:14 +08:00
init_data.py Allow create super user when start rag server. (#10634) 2025-11-24 19:02:08 +08:00
reload_config_base.py Format file format from Windows/dos to Unix (#1949) 2024-08-15 09:17:36 +08:00
runtime_config.py Admin: add 'show version' (#11079) 2025-11-06 19:24:46 +08:00