Brain search ranking (brain_search)
Local hits use SQLite FTS5 bm25 (brain_search.search_local): lower score means more relevant.
When the MCP tool passes prefer_stack (list of strings, e.g. python, react):
- The local path may return up to
min(limit × 5, 100)candidates so a strong stack match is not dropped before reranking. - After merging with optional Notion fallback hits, results are sorted by effective score
effective = bm25_score − stack_boost, wherestack_boostgrows when a row’sstackJSON overlaps a preferred label (exact or substring match). Boost is capped so bm25 still dominates for distant matches. - The final list is truncated to
limit.
Empty or whitespace-only query: handlers return an immediate message; search_with_fallback returns no results and a warning explaining that the query is empty.