6fe5596c13
Replace custom keyword/fuzzy search algorithms with industry-standard BM25 sparse vectors, combined with dense semantic vectors using Qdrant's native Reciprocal Rank Fusion (RRF). This consolidates search architecture and improves relevance for both semantic and keyword queries. Key changes: - Add fastembed dependency for BM25 sparse vector generation - Update Qdrant collection schema to support named vectors (dense + sparse) - Create BM25SparseEmbeddingProvider using FastEmbed's Qdrant/bm25 model - Implement BM25HybridSearchAlgorithm with native Qdrant RRF prefetch - Update document processor to generate both dense and sparse embeddings - Simplify nc_semantic_search() tool to use BM25 hybrid only - Remove legacy keyword.py, fuzzy.py, and custom hybrid.py (736 lines) - Update ADR-014 with implementation notes and test results Benefits: - Consolidated architecture (single Qdrant database) - Native database-level RRF fusion (more efficient) - Industry-standard BM25 (replaces brittle custom keyword search) - Better relevance across semantic and keyword queries - Simplified codebase (-285 net lines) Tests: All 125 tests passing (118 unit, 7 integration) Implements ADR-014: Replace Custom Keyword Search with BM25 Hybrid Search 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
28 lines
834 B
Python
28 lines
834 B
Python
"""Search algorithms module for BM25 hybrid search.
|
|
|
|
This module provides BM25 hybrid search combining:
|
|
- Dense semantic vectors (vector similarity via embeddings)
|
|
- Sparse BM25 vectors (keyword-based retrieval)
|
|
|
|
Results are fused using Qdrant's native Reciprocal Rank Fusion (RRF) for
|
|
optimal relevance across both semantic and keyword queries.
|
|
"""
|
|
|
|
from nextcloud_mcp_server.search.algorithms import (
|
|
NextcloudClientProtocol,
|
|
SearchAlgorithm,
|
|
SearchResult,
|
|
get_indexed_doc_types,
|
|
)
|
|
from nextcloud_mcp_server.search.bm25_hybrid import BM25HybridSearchAlgorithm
|
|
from nextcloud_mcp_server.search.semantic import SemanticSearchAlgorithm
|
|
|
|
__all__ = [
|
|
"NextcloudClientProtocol",
|
|
"SearchAlgorithm",
|
|
"SearchResult",
|
|
"get_indexed_doc_types",
|
|
"SemanticSearchAlgorithm",
|
|
"BM25HybridSearchAlgorithm",
|
|
]
|