Search Your Notes for Part of a Word and Most Engines Find Nothing
Search your notes for part of a word and most engines find nothing. In a receipt run on 22 November 2026, four of six search-engine setups — SQLite FTS5's default tokenizer, MiniSearch, Lunr and FlexSearch — returned no note for otebook, the tail of "notebook". They index whole words. A substring search finds it every time.1
The test takes ten seconds. Pick a word you know sits in one of your notes — notebook, a client's surname, a project code — and search for its last few letters. If nothing comes back, your search box is a word index. Then search for the first few letters. A hit means it also matches prefixes.
A word index is not a bug. It is the classic design for full-text search — the inverted index — because it keeps search fast and the index small. It also has a blind spot exactly one word wide.
What follows is the mechanism, a forum report that walked into it, and a receipt anyone can rerun in a few lines of Python. Then come the three ways to find a fragment — each with its price.
The one-query test, and what each result means
Search for the last few letters of a word you know is in a note — otebook for "notebook". No result means a word index: it stores whole words and looks your query up as one. A result means substring matching. Searching for the first letters next tells prefix support apart from whole words only.
| You search | You get | Your search is |
|---|---|---|
otebook (end of a word) | nothing | a word index |
otebook | the note | substring matching — a trigram index or a scan |
note (start of a word), after otebook missed | the note | a word index with prefix matching |
note, after otebook missed | nothing | a word index, whole words only |
Two more probes are worth a minute. Try the middle of a word, ebo. Then try a fragment of two letters.
The second one surprises people. A substring index built on three-letter pieces cannot see two letters at all — that cost comes up below.
The test works on any search box, because it asks the one question that separates the two designs: does the engine know about letters, or only about words?
The problem in concrete terms: a forum report, the right way round
On 20 November 2026 a user on the Obsidian forum posted a one-line note, ab } = a. The phrase search " } = a" found it. The phrase search "b } = a" — the same text, started one letter inside a word — did not. The reporter's conclusion was that content search matches whole words.2
The thread is worth reading carefully, because its first post states the result backwards. It labelled "b } = a" Search1 and " } = a" Search2, and reported that Search1 matched and Search2 did not. A second user, dawni, replied that the opposite should happen: "That means that a search for "b" won’t return ab from the note content."2 dawni added that note titles behave differently.
The reporter came back the same day: "Sorry, I meant that Search2 matches but Search1 doesn’t."2 The search's own explanation panel had described the failing query as Contains exact text: "b } = a". The reporter settled on the reason: "content search seems to do word matching, so exact matching there requires words to be written in full."2
A third user offered a workaround — a regular expression, typed as / } = a — and gave the reason plainly: "This way you can match mid-string."2 Obsidian's help page documents regular expressions the same way: "surround the expression with forward slashes (/)".3
Obsidian's search was not run for this piece; its behaviour is what the thread reports. The engines below can be scripted.
The question itself is old. On Stack Overflow, "PostgreSQL: Full Text Search - How to search partial words?", asked on 25 March 2010, had 72,767 views on 22 November 2026. The MySQL version had 24,177 and the SQL Server 2008 version 17,601. "How to search a substring using FTS5 in SQLite" had 2,568.4 The forum thread had 73 views and five posts in its first two days.2
Why a word index cannot see inside a word
A full-text index is a list of words, each pointing at the notes that contain it. The engine splits a note into words when it saves it, and splits your query the same way when you search. otebook is not in the list, so the lookup returns nothing. It returns nothing quickly — that is the design.
Russ Cox, describing the index behind Google Code Search in January 2012, put the structure in one sentence: "The key data structure is called a posting list or inverted index, which lists, for every possible search term, the documents that contain that term."5
The splitting rule decides what counts as a word. SQLite's default FTS5 tokenizer, unicode61, "classifies all unicode characters as either "separator" or "token" characters. By default all space and punctuation characters, as defined by Unicode 6.1, are considered separators".6 Letters and digits make words. Everything else is a gap.
Here is what the two kinds of index store for one note:
note 1: "Book the notebook for Friday."
word index (FTS5 unicode61) trigram index (FTS5 trigram)
book -> note 1 boo ook ...
for -> note 1 not ote teb ebo boo ook
friday -> note 1 for fri rid ida day ...
notebook -> note 1 (every 3-character run, spaces included)
the -> note 1
query "otebook"
word index: no entry "otebook" -> nothing
trigram: ote, teb, ebo, boo, ook all in note 1 -> note 1
A word index answers "which notes contain this word?" A trigram index answers "which notes contain these three-letter runs, in this order?" Only the second question has an answer for otebook.
Cox made the same point about regular expressions: "Regular expression matches do not always line up nicely on word boundaries, so the inverted index cannot be based on words like in the previous example."5 His index was built on three-character pieces instead.
The standard textbook gives the same idea a general name. In Introduction to Information Retrieval, Manning, Raghavan and Schütze define a k-gram index for wildcard queries, with the example "Thus cas, ast and stl are all 3-grams occurring in the term castle."7
Punctuation fails the other way: a false hit
A word index also throws punctuation away. SQLite FTS5's default tokenizer treats } and = as separators, so the phrase "} = a" becomes the single word a. In the receipt it matched ab } = a — and also a note reading a plan for Monday, which contains no brace and no equals sign.1
The receipt makes this visible by listing the index's vocabulary. For the notes ab } = a and a plan for Monday, the word index holds five entries: a, ab, for, monday, plan.1 The brace and the equals sign are gone. A query can only be matched against what was kept.
MiniSearch 7.2.0 did the same at its defaults: b } = a returned the Monday note too.1
So the same design fails twice on code-like text. It misses a phrase that starts inside a word, and it reports a match for a phrase it never compared.
The receipt cannot say whether Obsidian's search reduces phrases this way. It does show that a plain word index produces the forum's exact pattern — a hit on " } = a", a miss on "b } = a" — without ever matching the brace.1
For notes full of code, config snippets or formulas, that is the more dangerous half. A miss sends you looking elsewhere. A false hit tells you that you found it.
The receipt: six engine setups, five fragments
On 22 November 2026, four short notes went into six search-engine setups: SQLite 3.46.1 FTS5 with its default and its trigram tokenizer, plus MiniSearch 7.2.0, Lunr 2.3.9, FlexSearch 0.8.212 and Fuse.js 7.5.0 on Node 20.20.2. ripgrep 15.1.0 and JavaScript's String.includes ran as substring baselines.1
The notes were Book the notebook for Friday., ab } = a, Call Priya re: roadmap (draft v2). and a plan for Monday. Each engine ran at its defaults; the parentheses name the option that changed the answer.
| Engine (version, defaults) | book whole word | note start | otebook end | ebo middle | b } = a mid-word phrase |
|---|---|---|---|---|---|
SQLite FTS5 unicode61 (3.46.1) | ✓ | ✗ (note* ✓) | ✗ | ✗ | ✗ |
SQLite FTS5 trigram | ✓ | ✓ | ✓ | ✓ | ✓ |
| MiniSearch 7.2.0 | ✓ | ✗ (prefix: true ✓) | ✗ (✗ with prefix) | ✗ | false hit on a plan for Monday |
| Lunr 2.3.9 | ✓ | ✗ (note* ✓) | ✗ (*otebook* ✓) | ✗ | ✗ |
| FlexSearch 0.8.212 | ✓ | ✗ (tokenize: "forward" ✓) | ✗ (tokenize: "full" ✓) | ✗ | ✗ |
| Fuse.js 7.5.0 (fuzzy) | ✓ | ✓ | ✓ near the start · ✗ ~600 characters in | ✓ | ✓ |
ripgrep 15.1.0 -F -i | ✓ | ✓ | ✓ | ✓ | ✓ |
JavaScript String.includes | ✓ | ✓ | ✓ | ✓ | ✓ |
Four of the six engine setups found nothing for otebook at their defaults. Fuse.js found it in a short note and missed it when the same sentence sat about 600 characters into a longer one.1 Only the trigram tokenizer and the two scans found every fragment.
The SQLite half fits in a dozen lines, and Python ships with SQLite, so it runs anywhere Python does:
import sqlite3
notes = {1: "Book the notebook for Friday.", 2: "ab } = a",
3: "Call Priya re: roadmap (draft v2).", 4: "a plan for Monday"}
queries = ['"book"', 'note*', '"otebook"', '"ebo"',
'"} = a"', '"b } = a"', '"ro"', '"v2"']
print("sqlite", sqlite3.sqlite_version)
for tok in ["unicode61", "trigram"]:
db = sqlite3.connect(":memory:")
db.execute(f"CREATE VIRTUAL TABLE t USING fts5(body, tokenize='{tok}')")
db.executemany("INSERT INTO t(rowid, body) VALUES (?, ?)", notes.items())
for q in queries:
rows = [r[0] for r in db.execute("SELECT rowid FROM t WHERE t MATCH ?", (q,))]
print(f"{tok:10} {q:12} {rows}")
On SQLite 3.46.1, unicode61 returns nothing for "otebook", "ebo" and "b } = a", and returns notes 2 and 4 for "} = a". The trigram table finds all three fragments. It returns nothing for "ro" — and nothing for "v2", a whole word the word index finds.1
The ripgrep half is one flag:
rg -l -F -i 'otebook' notes/ # notes/1.md — a fixed-string substring search
rg -l -w -F -i 'otebook' notes/ # nothing — -w demands whole words
With -w, ripgrep found none of the four fragments — otebook, ebo, b } = a, ro. Without it, ripgrep found all four.1
Three ways to find a fragment, and what each costs
There are three ways to find text that starts or ends inside a word. Prefix search is cheap and only sees the start of a word. A substring index, usually built on trigrams, sees anywhere but costs index size and loses very short queries. A scan — grep, a regular expression, includes — always works and reads every note.
Prefix search: cheap, and only the front of a word
Many word indexes can also match the start of a word, because a sorted list of words makes "everything beginning with note" one range lookup. FTS5 and Lunr spell it note*. MiniSearch has a switch, and its README comment states the scope: "// Prefix search (so that 'moto' will match 'motorcycle')".8
PostgreSQL writes it note:* in a to_tsquery. Its documentation is exact about the limit: "Such a lexeme will match any word in a tsvector that begins with the given string."9
Begins with. A prefix query finds note in notebook and never otebook. In the receipt, MiniSearch with prefix: true found note and still missed otebook.1
A substring index: sees anywhere, costs space
A trigram index stores every three-character run of the text, so a query of three or more characters can match anywhere. SQLite's documentation says so directly: "The trigram tokenizer extends FTS5 to support substring matching in general, instead of the usual token matching. When using the trigram tokenizer, a query or phrase token may match any sequence of characters within a row, not just a complete token."6
PostgreSQL ships the same idea as the pg_trgm extension, defined in one line: "A trigram is a group of three consecutive characters taken from a string."10 Its GIN and GiST indexes "additionally support trigram-based index searches for LIKE, ILIKE, ~, ~* and = queries" — the ~ being a regular-expression match.10
-- SQLite: a substring index, and LIKE that can use it
CREATE VIRTUAL TABLE notes_tri USING fts5(body, tokenize='trigram');
SELECT rowid FROM notes_tri WHERE notes_tri MATCH '"otebook"';
SELECT rowid FROM notes_tri WHERE body LIKE '%otebook%';
-- PostgreSQL: a trigram index under LIKE and regex
CREATE EXTENSION pg_trgm;
CREATE INDEX notes_body_trgm ON notes USING GIN (body gin_trgm_ops);
SELECT id FROM notes WHERE body ILIKE '%otebook%';
The first cost is size. Over 623 Markdown files — 15,250,406 bytes, the final drafts of this blog's posts — a contentless FTS5 word index took 5,058,560 bytes, a third of the text. A trigram index over the same files took 32,813,056 bytes, 2.15 times the text: 6.5 times the word index.1
The second cost is short queries. SQLite documents it: "Substrings consisting of fewer than 3 unicode characters do not match any rows when used with a full-text query."6 In the receipt that hid the fragment ro — and the whole word v2, which the word index found.1 A trigram index is not a superset of a word index.
Cox explained why three is the number: "In practice, there are too few distinct 2-grams and too many distinct 4-grams, so 3-grams (trigrams) it is."5 The textbook records why indexes compromise at all. Its alternative for wildcards, the permuterm index, "for a dictionary of English terms, this can represent an almost ten-fold space increase".7
A scan: always works, reads everything
A scan does not use an index. It reads each note and checks for the letters — String.includes, a regular expression, rg -F without -w. It finds any fragment of any length, including two letters and punctuation. Its cost grows with the size of your notes, because every query reads all of them.
For a personal collection that cost is often small. A grep over a folder of plain-text notes is the whole argument of Don't Build a RAG Over Your Vault. Grep It., which uses rg -w to find whole words.11 When you are hunting a fragment, drop the -w.
Lunr, which offers an in-index wildcard, warns about it in its guide: "Leading wildcards, as in the above example, should be used sparingly. They can have a negative impact on the performance of a search, especially in large indexes."12
A scan is also the answer the forum thread reached. A regular expression does not care where words start.
Switches inside the libraries
Several libraries change their answer with one option, and each option moves the cost. In the receipt, Lunr's leading wildcard and FlexSearch's tokenize: "full" found otebook. MiniSearch's prefix option did not. Fuse.js found fragments near the start of a note and lost them further in.
// Node 20.20.2 · MiniSearch 7.2.0 · Lunr 2.3.9 · FlexSearch 0.8.212 · Fuse.js 7.5.0
miniSearch.search('otebook', { prefix: true }); // [] prefix sees the start only
lunrIndex.search('*otebook*'); // [1] leading wildcard
new FlexSearch.Index({ tokenize: 'full' }); // finds 'otebook': every partial indexed
new Fuse(notes, { keys: ['body'], ignoreLocation: true }); // drops the position window
notes.filter(n => n.body.toLowerCase().includes('otebook')); // the scan, always works
FlexSearch prices its options in its own README. The default tokenizer is described as "index the full term", with a memory factor of 1. The "full" tokenizer is "index every consecutive partial", with a memory factor of "n * (n - 1)", where n is the length of the term.13 For a ten-letter word, that is a factor of ninety.
Fuse.js is a fuzzy matcher, not a substring engine, and its documentation states the window: "With defaults (threshold: 0.6, distance: 100), the pattern must appear within 60 characters of position 0 to match."14 That is why the same sentence was found in a short note and missed about 600 characters into a long one. With ignoreLocation: true it was found again.1
Fuzzy matching is also noisy for this job. At its defaults, Fuse.js returned three of the four notes for ro.1
Trade-offs, and what this receipt does not show
This receipt tests search engines and libraries, not note apps. No note app's search box was run for it, so it cannot say which apps use a word index. It measures which notes come back for five fragments — not ranking, speed, or memory at query time. It ran on one machine, with one SQLite build.
The engines are tested on one property only. Speed and ranking are a separate question, measured for the same browser libraries in Searching Your Notes in the Browser: FlexSearch vs MiniSearch vs Fuse.js, Measured.15
Accents are another way search misses text you know is there. Whether resume finds résumé depends on folding, covered in Search Your Notes for "resume" and Whether You Find "résumé" Depends on the Engine.16 A trigram index needs its own remove_diacritics option to fold — and with that option set, SQLite's trigram tables no longer serve LIKE and GLOB from the index.6
The pragmatic setup is two searches. Keep the word index for everyday queries. Keep a substring scan — a regex box, or rg over exported files — for the day the word index says nothing.
The case for searching over filing is made in Stop Filing, Start Finding: Search Beats Folders.17 This post is about which search finds what.
Frequently Asked Questions
Why doesn't my note search find part of a word?
Your search is probably a word index. It splits each note into words when it saves it, and looks your query up as one word. otebook is not a word in the index, so nothing comes back. In a 22 November 2026 receipt, four of six engine setups missed it at their defaults.
How to search a substring using FTS5 in SQLite?
Create the table with the trigram tokenizer: CREATE VIRTUAL TABLE t USING fts5(body, tokenize='trigram'). A query of three or more characters then matches anywhere in a row, and LIKE '%otebook%' can use the same index. Queries shorter than three characters match nothing.
PostgreSQL: Full Text Search - How to search partial words?
For the start of a word, use the prefix operator: to_tsquery('note:*') matches any word that begins with note. For text anywhere in a word, use the pg_trgm extension with a GIN index using gin_trgm_ops; it lets LIKE, ILIKE and regular-expression queries use a trigram index.
What is the difference between prefix search and substring search?
Prefix search matches words that begin with the query: note finds notebook. Substring search matches the query anywhere: otebook and ebo find notebook too. Prefix search works on an ordinary word index. Substring search needs a trigram index or a scan of every note.
Why can't a trigram index find two letters?
A trigram index stores three-character runs, so a shorter query has nothing to look up. SQLite documents that substrings under three characters match no rows in a full-text query. In the receipt the trigram table missed the fragment ro and the two-character word v2, which the word index found.
Is regex search slower than full-text search? Usually, on large collections. A regular expression with no index reads every note on every query, while a word index looks the query up directly. Lunr warns that leading wildcards can hurt performance in large indexes. For a personal collection, a scan with a tool like ripgrep is often fast enough.
Does fuzzy search find part of a word?
Sometimes, and not reliably. Fuse.js found otebook in a short note and missed it about 600 characters into a long one, because its defaults only match within 60 characters of the start. It also returned three of four notes for ro. Fuzzy search tolerates typos; it is not substring search.
A word index answers the question of which words you wrote. A substring search answers the question of which letters. The note you cannot find usually lives in the gap between the two — and the fix is knowing which question your search box was built to ask.
Whichever search you use, notes kept as open Markdown on your own device can always be read by a second one — which is how mnmnote.com keeps them.
Footnotes
-
MNMNOTE, measured substring-search run, 22 November 2026. SQLite 3.46.1 FTS5 (
unicode61,porter unicode61,trigram) through Pythonsqlite3; ripgrep 15.1.0; MiniSearch 7.2.0, Lunr 2.3.9, FlexSearch 0.8.212 and Fuse.js 7.5.0 on Node 20.20.2. Index size: contentless FTS5 tables over 623 Markdown files (15,250,406 bytes), optimized and vacuumed. ↩ ↩2 ↩3 ↩4 ↩5 ↩6 ↩7 ↩8 ↩9 ↩10 ↩11 ↩12 ↩13 ↩14 -
NoNameBohr and others, "Core-Search fails to find content matches. Why?," Obsidian Forum, thread 122088, opened 20 November 2026. https://forum.obsidian.md/t/122088 — counts as of 22 November 2026. ↩ ↩2 ↩3 ↩4 ↩5 ↩6
-
Obsidian Help, "Search," regular-expressions section. https://github.com/obsidianmd/obsidian-help/blob/master/en/Plugins/Search.md Accessed 2026-11-22. ↩
-
Stack Overflow, questions 2513501 (asked 25 March 2010), 2716748, 2962776 and 75832600. https://stackoverflow.com/q/2513501 · https://stackoverflow.com/q/2716748 · https://stackoverflow.com/q/2962776 · https://stackoverflow.com/q/75832600 — view counts as of 22 November 2026. ↩
-
Russ Cox, "Regular Expression Matching with a Trigram Index or How Google Code Search Worked," January 2012. https://swtch.com/~rsc/regexp/regexp4.html Accessed 2026-11-22. ↩ ↩2 ↩3
-
SQLite, "SQLite FTS5 Extension," §4.3.1 (Unicode61 tokenizer) and §4.3.4 (The Trigram Tokenizer). https://www.sqlite.org/fts5.html Accessed 2026-11-22. ↩ ↩2 ↩3 ↩4
-
Christopher D. Manning, Prabhakar Raghavan and Hinrich Schütze, Introduction to Information Retrieval, Cambridge University Press, 2008, §3.2.2 "k-gram indexes for wildcard queries." https://nlp.stanford.edu/IR-book/html/htmledition/k-gram-indexes-for-wildcard-queries-1.html Accessed 2026-11-22. ↩ ↩2
-
Luca Ongaro, MiniSearch 7.2.0,
README.md. https://github.com/lucaong/minisearch/blob/v7.2.0/README.md Accessed 2026-11-22. ↩ -
PostgreSQL Global Development Group, PostgreSQL 19 Documentation, §12.3.2 "Parsing Queries" (
to_tsqueryprefix matching). https://www.postgresql.org/docs/current/textsearch-controls.html Accessed 2026-11-22. ↩ -
PostgreSQL Global Development Group, PostgreSQL 19 Documentation, "pg_trgm — support for similarity of text using trigram matching." https://www.postgresql.org/docs/current/pgtrgm.html Accessed 2026-11-22. ↩ ↩2
-
MNMNOTE, "Don't Build a RAG Over Your Vault. Grep It." https://blog.mnmnote.com/posts/grep-beats-rag-when-your-vault-is-small ↩
-
Lunr, "Searching" guide. https://lunrjs.com/guides/searching.html Accessed 2026-11-22. ↩
-
FlexSearch 0.8.212,
README.md, tokenizer table. https://github.com/nextapps-de/flexsearch/blob/master/README.md Accessed 2026-11-22. ↩ -
Fuse.js, "Fuzzy search" documentation,
distanceoption. https://github.com/krisk/Fuse/blob/main/docs/fuzzy-search.md Accessed 2026-11-22. ↩ -
MNMNOTE, "Searching Your Notes in the Browser: FlexSearch vs MiniSearch vs Fuse.js, Measured." https://blog.mnmnote.com/posts/full-text-search-in-the-browser-benchmarked ↩
-
MNMNOTE, "Search Your Notes for "resume" and Whether You Find "résumé" Depends on the Engine." https://blog.mnmnote.com/posts/search-your-notes-for-resume-and-whether-you-find-resume-depends-on-the-engine ↩
-
MNMNOTE, "Stop Filing, Start Finding: Search Beats Folders." https://blog.mnmnote.com/posts/find-your-notes-by-searching-not-organizing ↩