Enable query analysis by default (runs in parallel with HyDE)

Query analysis and HyDE are both LLM-based operations that run in
parallel via asyncio.gather, so enabling query analysis adds no
extra latency when HyDE is also enabled.

Query analysis provides:
- Modality detection from query content
- Query cleaning and reformulation
- Query variants for better recall

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
mruwnik 2025-12-21 16:29:28 +00:00
parent f9e9ad5f4b
commit 7e1770f384
3 changed files with 6 additions and 3 deletions

View File

@ -57,11 +57,11 @@ export const SearchForm = ({ isLoading, onSearch }: SearchFormProps) => {
const [dynamicFilters, setDynamicFilters] = useState<Record<string, any>>({})
const [limit, setLimit] = useState(10)
// Search enhancement options - initialize to match server defaults
// Server defaults: BM25=true, HyDE=true, Reranking=true, QueryAnalysis=false
// All enabled by default (query analysis runs in parallel with HyDE, no extra latency)
const [useBm25, setUseBm25] = useState<boolean | undefined>(true)
const [useHyde, setUseHyde] = useState<boolean | undefined>(true)
const [useReranking, setUseReranking] = useState<boolean | undefined>(true)
const [useQueryAnalysis, setUseQueryAnalysis] = useState<boolean | undefined>(false)
const [useQueryAnalysis, setUseQueryAnalysis] = useState<boolean | undefined>(true)
const { getMetadataSchemas, getTags } = useMCP()
useEffect(() => {

View File

@ -470,7 +470,9 @@ async def search_chunks(
else settings.ENABLE_RERANKING
)
use_query_analysis = (
config.useQueryAnalysis if config.useQueryAnalysis is not None else False
config.useQueryAnalysis
if config.useQueryAnalysis is not None
else settings.ENABLE_QUERY_ANALYSIS
)
internal_limit = limit * CANDIDATE_MULTIPLIER

View File

@ -178,6 +178,7 @@ ENABLE_BM25_SEARCH = boolean_env("ENABLE_BM25_SEARCH", True)
ENABLE_SEARCH_SCORING = boolean_env("ENABLE_SEARCH_SCORING", True)
ENABLE_HYDE_EXPANSION = boolean_env("ENABLE_HYDE_EXPANSION", True)
HYDE_TIMEOUT = float(os.getenv("HYDE_TIMEOUT", "3.0"))
ENABLE_QUERY_ANALYSIS = boolean_env("ENABLE_QUERY_ANALYSIS", True) # Runs in parallel with HyDE
ENABLE_RERANKING = boolean_env("ENABLE_RERANKING", True)
RERANK_MODEL = os.getenv("RERANK_MODEL", "rerank-2-lite")
MAX_PREVIEW_LENGTH = int(os.getenv("MAX_PREVIEW_LENGTH", DEFAULT_CHUNK_TOKENS * 16))