mirror of
https://github.com/catlog22/Claude-Code-Workflow.git
synced 2026-03-21 19:08:17 +08:00
feat(codexlens): Improve search defaults and add explicit SPLADE mode
Config changes: - Disable SPLADE by default (slow ~360ms), use FTS instead - Enable use_fts_fallback by default for faster sparse search CLI improvements: - Fix duplicate index_app typer definition - Add cascade_search dispatch for cascade method - Rename 'mode' to 'method' in search output - Mark embeddings-status, splade-status as deprecated - Add enable_splade and enable_cascade to search options Hybrid search: - Add enable_splade parameter for explicit SPLADE mode - Add fallback handling when SPLADE is requested but unavailable
This commit is contained in:
@@ -112,6 +112,7 @@ class HybridSearchEngine:
|
||||
enable_fuzzy: bool = True,
|
||||
enable_vector: bool = False,
|
||||
pure_vector: bool = False,
|
||||
enable_splade: bool = False,
|
||||
) -> List[SearchResult]:
|
||||
"""Execute hybrid search with parallel retrieval and RRF fusion.
|
||||
|
||||
@@ -122,6 +123,7 @@ class HybridSearchEngine:
|
||||
enable_fuzzy: Enable fuzzy FTS search (default True)
|
||||
enable_vector: Enable vector search (default False)
|
||||
pure_vector: If True, only use vector search without FTS fallback (default False)
|
||||
enable_splade: If True, force SPLADE sparse neural search (default False)
|
||||
|
||||
Returns:
|
||||
List of SearchResult objects sorted by fusion score
|
||||
@@ -135,6 +137,9 @@ class HybridSearchEngine:
|
||||
>>> results = engine.search(Path("project/_index.db"),
|
||||
... "how to authenticate users",
|
||||
... enable_vector=True, pure_vector=True)
|
||||
>>> # SPLADE sparse neural search
|
||||
>>> results = engine.search(Path("project/_index.db"), "auth flow",
|
||||
... enable_splade=True, enable_vector=True)
|
||||
>>> for r in results[:5]:
|
||||
... print(f"{r.path}: {r.score:.3f}")
|
||||
"""
|
||||
@@ -158,7 +163,7 @@ class HybridSearchEngine:
|
||||
|
||||
# Determine which backends to use
|
||||
backends = {}
|
||||
|
||||
|
||||
# Check if SPLADE is available
|
||||
splade_available = False
|
||||
# Respect config.enable_splade flag and use_fts_fallback flag
|
||||
@@ -191,6 +196,23 @@ class HybridSearchEngine:
|
||||
"To use pure vector search, enable vector search mode."
|
||||
)
|
||||
backends["exact"] = True
|
||||
elif enable_splade:
|
||||
# Explicit SPLADE mode requested via CLI --method splade
|
||||
if splade_available:
|
||||
backends["splade"] = True
|
||||
if enable_vector:
|
||||
backends["vector"] = True
|
||||
else:
|
||||
# SPLADE requested but not available - warn and fallback
|
||||
self.logger.warning(
|
||||
"SPLADE search requested but not available. "
|
||||
"Falling back to FTS. Run 'codexlens index splade' to enable."
|
||||
)
|
||||
backends["exact"] = True
|
||||
if enable_fuzzy:
|
||||
backends["fuzzy"] = True
|
||||
if enable_vector:
|
||||
backends["vector"] = True
|
||||
else:
|
||||
# Hybrid mode: default to SPLADE if available, otherwise use FTS
|
||||
if splade_available:
|
||||
|
||||
Reference in New Issue
Block a user