Bug Description
_truncate_around_matches() in tools/session_search_tool.py (line 89) splits the search query on whitespace to find text positions for centering the truncation window. This means FTS5 boolean operators like OR, AND, NOT become search terms themselves.
For a query like "Luka OR resume OR Injoy", the function searches for ["luka", "or", "resume", "or", "injoy"]. The word "or" matches extremely early in any conversation, so the 100K char window centers on irrelevant content near the top of the transcript.
Steps to Reproduce
- Have a long session (280K+ chars, full day of conversation)
- Search with a query containing OR operators:
"topic1 OR topic2 OR topic3"
- The relevant content is in the latter half of the session
_truncate_around_matches finds "or" on line ~50, centers window there
- Gemini/Claude summarizer receives a window that doesn't contain the actual matching content
- Summary correctly reports "no discussion about topic1/topic2/topic3 found"
Root Cause
# line 100 in session_search_tool.py
query_terms = query.lower().split()
This naive split doesn't strip FTS5 operators. The FTS5 engine correctly interprets OR as a boolean operator, but the truncation function treats it as a literal search term.
Suggested Fix
Strip known FTS5 operators before splitting:
_FTS5_OPERATORS = {"and", "or", "not", "near"}
query_terms = [t for t in query.lower().split() if t not in _FTS5_OPERATORS]
Impact
Any session search using boolean operators (which the tool's own schema recommends: "Use OR between keywords for best results") will mis-center the truncation window on common English words, causing the summarizer to miss the actual relevant content.
Bug Description
_truncate_around_matches()intools/session_search_tool.py(line 89) splits the search query on whitespace to find text positions for centering the truncation window. This means FTS5 boolean operators likeOR,AND,NOTbecome search terms themselves.For a query like
"Luka OR resume OR Injoy", the function searches for["luka", "or", "resume", "or", "injoy"]. The word "or" matches extremely early in any conversation, so the 100K char window centers on irrelevant content near the top of the transcript.Steps to Reproduce
"topic1 OR topic2 OR topic3"_truncate_around_matchesfinds "or" on line ~50, centers window thereRoot Cause
This naive split doesn't strip FTS5 operators. The FTS5 engine correctly interprets
ORas a boolean operator, but the truncation function treats it as a literal search term.Suggested Fix
Strip known FTS5 operators before splitting:
Impact
Any session search using boolean operators (which the tool's own schema recommends: "Use OR between keywords for best results") will mis-center the truncation window on common English words, causing the summarizer to miss the actual relevant content.