Skip to content

Inbox search: words in double quotes are an exact phrase - #4117

Merged
backnotprop merged 2 commits into
mainfrom
feat/inbox-search-quoted-phrase
Nov 27, 2026
Merged

backnotprop merged 2 commits into
mainfrom
feat/inbox-search-quoted-phrase

Conversation

@backnotprop

@backnotprop backnotprop commented Nov 27, 2026 •

Copy link
Copy Markdown
Owner

What a person sees

In Inbox search (⌘K), words in double quotes are now an exact phrase.

  • "file viewer" finds only places where those words are next to each other, in that order, inside one paragraph of one field (a subject, a thread name, a body, one question). Only spaces, punctuation or one line break may stand between them: a phrase never runs from one paragraph, heading, list item, table row or code fence into the next, so a soft-wrapped sentence matches but blank. at the end of one paragraph and Viewer at the start of the next do not. Each result highlights the phrase as one run.
  • One-letter words and digits count inside quotes: "step 1" finds step 1 and Step 1:, not step 2 or step 10; "plan a review" is not plan b review; "v1.2" is not v1.3.
  • "file viewer" blank finds the phrase, plus the word blank anywhere. The last word typed is still matched as the start of a word, as before ("file viewer" bla works).
  • If you use more than one phrase, every phrase must match.
  • "file" matches only the whole word file, not files.
  • While you type "file view with no closing quote yet, the search treats it as a phrase of what you have typed so far. Its last word is matched as the start of a word, so results stay on screen as you type.
  • Curly quotes (“ ”), as a phone types them, and German „ “ and French « » quotes work the same way. A curly apostrophe is not a quote. Empty quotes, or quotes holding only spaces, are ignored.
  • A quoted CJK phrase matches its literal characters. Known limit: the index still finds candidates by segmenter words, so "東京都" misses 東京都庁 (cut 東京|都庁).
  • A query with no quote mark gives the same results in the same order as before (search-parity.test.ts passes unchanged and was not re-recorded).
  • This works with Best match and Newest, and with every filter. When you open a message, the phrase is highlighted there as one range, even when markup splits it (file **viewer**).
  • There are no new controls, words, settings or shortcuts. The empty state is unchanged.

Agents' search uses the same engine, so quotes work for them too. The agent's tool description has not changed. One line was added to plannotator inbox --help under search:

  • Words in double quotes are an exact phrase: "file viewer" finds those words side by side, in that order; a quoted word matches only that whole word.

Linked computers

The query is sent to a linked computer exactly as typed. If that computer runs this version, it applies the phrase. An older Inbox reads a quote mark as punctuation: it answers with its plain word matches, the merge proceeds as before, and nothing fails. So until the other computer updates, its rows can include messages where the words are far apart.

How

  • The index is the candidate filter, as built (postings intersected, then the phrase's index tokens next to each other in one field, now a streaming check with memory the size of the phrase).
  • Then a confirm, only for a query with a phrase of two tokens or more or a quoted one-letter word, only over the candidates left after the filters, best first: the document's fields are read again through the same builders the index uses (fieldsOf), a body as inboxSearchBlockText (a blank line before each line that starts a block, from forEachInboxSearchBodyLine), and inboxSearchPhrasesHold (packages/core/inbox-search.ts) checks every phrase with every token, one-letter ones too, never across a blank line. A phrase of ASCII words is one regex over the raw text (its yes is exact; a no falls back to the token check when the text holds a character that folds into a letter or a script the segmenter cuts).
  • Cost (packages/shared/inbox/search-confirm.ts): a group confirms best first until its page is full, then at most 64 more for its total. Candidates left unread count as found, so a total over that may run a little high; every row shown is confirmed.
  • Marks: the answer's terms carry each phrase with all its tokens ("step 1"); the row marks and the landing highlight use the same rule. The landing joins a block's text nodes as they stand (a <br> as a line break) and puts a blank line between blocks.

Speed

In process, 4,000 threads, 30,000 messages, 69 M characters; median/p95 ms (totals threads/messages/files/projects):

query main branch
rate limit 4.39/5.11 (8/2907/1/0) 4.30/4.91 (8/2907/1/0)
"rate limit" 4.26/4.81 6.38/7.16 (1/352/1/0)
"the an" 20.72/22.09 21.61/22.15 (0/396/0/0)
"step 1" 0.08/0.10 0.07/0.10 (no "step" in the seeded text)
"rate limit" retry 3.91/4.28 10.63/11.09 (0/322/0/0)
retry "a" 2.35/2.59 10.18/10.95 (2/4291/0/0)
the an 20.36/22.43 20.54/22.18 (16/26210/0/0)

Not checked

  • No Playwright e2e was added or run locally. The pictures come from Playwright driving the built window against mocked routes, with answers computed by main's engine and this branch's engine.
  • Test files that start an Inbox (inbox-search.test.ts, inbox-search-machines.test.ts, inbox-help.test.ts) were not run locally; CI runs them.
  • The --help line (unchanged) has not had a clean-room agent test.
  • A table row's cells are one block: a phrase may run from one cell to the next in the same row.

A quoted phrase matches only where its words stand together, in order, in
one field; a quoted word is that whole word; a quote not closed yet is a
phrase of what is typed, its last token a prefix; curly quotes count; empty
quotes are ignored. The index intersects the terms first and checks the
phrase on the candidates. A query with no quote mark is unchanged. Results,
the window's marks and the landing highlight mark a phrase as one run.
@backnotprop backnotprop added the ci:e2e Run the full browser suite (Inbox window e2e) on this PR label Nov 27, 2026
…rds kept, never across a block

The index stays the candidate filter; a query with a phrase then reads each
candidate's fields again (the same field builders the index uses) and
confirms every phrase: its tokens one after another with only separators
between them, one-letter tokens kept, never across a blank line, heading,
list item, table row, fence or dropped block. A group confirms best first
until its page is full, then at most 64 more for its total. The window's
landing highlight and the row marks follow the same rule. German and French
quote marks count as quotes.
@backnotprop
backnotprop marked this pull request as ready for review November 27, 2026 02:51
@backnotprop
backnotprop merged commit 21091b6 into main Nov 27, 2026
57 checks passed
yermakoffivan pushed a commit to yermakoffivan/plannotator that referenced this pull request Nov 27, 2026
…d Pele 1.13

core 0.25.35 carries what merged after 0.25.34 went to npm: exact-phrase
search in inbox-search (words in double quotes, backnotprop#4117, backnotprop#4124) and the
agent-gone event in external-annotation's ExternalAnnotationEvent (backnotprop#3698).
No exports subpath changes.

ui handles that agent-gone event, so its pin follows and core goes first.
ui 0.67.0 is a minor: DiagramSourceAcceptContext lets a host refuse a fence
by its source before any engine runs (backnotprop#4146), DIAGRAM_REFUSED_RESULT is
exported, Pele 1.13.0 with the inline fit changes (backnotprop#4113), the agent-gone
send failures (backnotprop#3698) and the plan header seams (backnotprop#3905). README and HANDOFF
name the new pair and the order (core first), and the hook and Pele notes
now name ui 0.67.0 instead of "the first ui after 0.66.0".

bun.lock is bun install's own output: the two package version lines.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ci:e2e Run the full browser suite (Inbox window e2e) on this PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant