RORK LABJP
PRICE — Rork Max spans $200 to $1,800 per month, with the upper tiers aimed at heavier builders and teamsFREE — The free tier lands at roughly five prompts per week, enough to try it but not to build on continuouslySHIP — App Store publishing is automated through builds, certificates, and submission, so you can ship an iOS app without a Mac or XcodeSIM — A browser-streamed simulator lets you watch your app run in a real Apple environment from your own browserNATIVE — It reaches HealthKit, ARKit and LiDAR, NFC, Dynamic Island, and Metal 3D — territory React Native cannot touchFUNDING — Rork raised a $15M seed led by Left Lane Capital, announced April 9, 2026, and acquired app builder PaperlinePRICE — Rork Max spans $200 to $1,800 per month, with the upper tiers aimed at heavier builders and teamsFREE — The free tier lands at roughly five prompts per week, enough to try it but not to build on continuouslySHIP — App Store publishing is automated through builds, certificates, and submission, so you can ship an iOS app without a Mac or XcodeSIM — A browser-streamed simulator lets you watch your app run in a real Apple environment from your own browserNATIVE — It reaches HealthKit, ARKit and LiDAR, NFC, Dynamic Island, and Metal 3D — territory React Native cannot touchFUNDING — Rork raised a $15M seed led by Left Lane Capital, announced April 9, 2026, and acquired app builder Paperline
Articles/Dev Tools
Dev Tools/2026-08-02Advanced

When Two-Character Queries Silently Return Nothing: Measuring Japanese Search Indexes in an Expo App

SQLite FTS5's trigram tokenizer returns zero rows for Japanese queries shorter than three characters, without raising anything. I benchmarked linear scan, a bigram inverted index, and FTS5 over a 20,000-item catalog to find the real threshold.

Rork532Expo165SQLite3FTS5Japanese searchPerformance25

Premium Article

One morning a family member told me that not a single cat wallpaper was showing up.

I checked on my own phone. Typing 猫 (cat) returned an empty list, instantly. The catalog holds more than six hundred cat titles. No error in the logs. No crash. Just nothing.

The cause was a search index I had shipped the week before. The catalog had grown, I decided a linear scan was surely running out of road, and I moved the whole thing onto SQLite's FTS5. It did get faster. It also dropped the single most common query length in Japanese, entirely.

What follows is what I found after sitting down and measuring properly. I ran a linear scan, a bigram inverted index, and FTS5 trigram over identical data to decide by numbers rather than intuition. The short version: I removed the index and went back to the linear scan.

Setting up something reproducible

Real catalog data can't be shared, so I generated a synthetic one deterministically. Titles follow a modifier + subject + suffix pattern, with three tags each, producing roughly 13–20 normalized characters per record — close to the real distribution.

// gen.mjs — linear congruential generator, so the same seed yields the same catalog
let seed = 20260802;
const rnd = () => (seed = (seed * 1103515245 + 12345) & 0x7fffffff) / 0x7fffffff;
const pick = (a) => a[Math.floor(rnd() * a.length)];
 
const subj = ["夜景", "桜", "富士山", "海", "星空", "猫", "森", "雪原", "花火", "滝", "紅葉", "銀河"];
const mod  = ["静かな", "淡い", "鮮やかな", "霧の", "真夜中の", "冬の", "黄昏の", "雨上がりの"];
const suf  = ["の風景", "のシルエット", "のグラデーション", "のパノラマ", "", ""];
const tagp = ["ミニマル", "ダーク", "パステル", "モノクロ", "和風", "自然", "高解像度", "縦向き"];
 
export function makeCatalog(n) {
  const out = [];
  for (let i = 0; i < n; i++) {
    out.push({
      id: "w" + i,
      title: pick(mod) + pick(subj) + pick(suf),
      tags: [pick(tagp), pick(tagp), pick(tagp)],
    });
  }
  return out;
}

Normalization has three layers: NFKC to collapse full-width and half-width forms, lowercasing, katakana folded to hiragana, and whitespace stripped. Absorbing orthographic variation is the well-trodden part. What mattered this time was the cost of running this function at all.

const norm = (s) =>
  s
    .normalize("NFKC")
    .toLowerCase()
    .replace(/[ァ-ヶ]/g, (c) => String.fromCharCode(c.charCodeAt(0) - 0x60))
    .replace(/\s+/g, "");

Everything ran in a Linux container on Node 22.22 and Python 3.10 (SQLite 3.37.2) — not on an iPhone. Read the ratios and orders of magnitude, not the absolute values. Devices are generally several times slower; a 3–5x correction has served me reasonably well.

The naive linear scan goes much further than expected

I started with the do-nothing implementation: build an array of normalized keys at load, then walk it with indexOf per query.

// Keep normalized keys in a flat array of strings
const keys = new Array(items.length);
for (let i = 0; i < items.length; i++) {
  keys[i] = norm(items[i].title + items[i].tags.join(""));
}
 
function search(q) {
  const nq = norm(q);
  const hits = [];
  for (let i = 0; i < keys.length; i++) {
    if (keys[i].indexOf(nq) >= 0) hits.push(i);
  }
  return hits;
}

Eight queries, twenty runs each, medians below. For contrast I also measured filter over an array of { id, k } objects.

ItemsFlat string arrayObject array + filterApprox. key memory
20,0000.80 ms1.11 ms1.4 MB
50,0001.99 ms2.79 ms3.6 MB
100,0004.05 ms6.48 ms7.2 MB
200,0008.50 ms12.43 ms14.4 MB
500,00020.21 ms29.65 ms35.9 MB

A 60fps frame budget is 16.7 ms. In this environment the scan stayed inside one frame up to 200,000 items. Even applying a 3–5x device correction, a catalog in the tens of thousands is comfortably within reach of a plain scan.

The 1.4x gap between the flat array and the object array is worth holding onto. It is one extra property access, but it happens once per item, so it compounds. Flattening your key storage is cheaper and more effective than designing an index.

My original decision to reach for an index was made before this table existed. I was working from the feeling that "twenty thousand is a lot."

Thank you for reading this far.

Continue Reading

What follows includes implementation code, benchmarks, and practical content we hope you'll find useful. This site runs without ads — server and development costs are supported entirely by members like you. If it's been helpful, we'd be truly grateful for your support.

WHAT YOU'LL LEARN
FTS5 trigram silently returns zero for queries under three characters. In my run, 猫 (606 matches), 夜景 (816), and 桜 (1,263) all vanished without an error
A linear scan over 20,000 items took 0.80 ms median. Adding an index is only justified once measurements actually breach the frame budget
The real bottleneck was startup normalization, not search: 39.5 ms at 20,000 items, cut to 1.1 ms by precomputing keys and shipping them newline-joined
Secure payment via Stripe · Cancel anytime

Unlock This Article

Get full access to the rest of this article. Buy once, read anytime. This site is ad-free — your support goes directly toward keeping it running.

or
Unlock all articles with Membership →
Share

Thank You for Reading

Rork Lab is ad-free, supported entirely by members like you. We publish practical guides daily with implementation code, benchmarks, and production-ready patterns. If you've found it useful, we'd love to have you on board.

  • Copy-paste ready implementation code
  • New advanced guides published daily
  • $5/mo or $10 for lifetime access
View Membership →

Related Articles

Dev Tools2026-07-10
Adding React Compiler to Expo Let Me Delete 41 Hand-Written memo Calls
I enabled React Compiler on Rork-generated React Native screens and measured the rerender counts with Profiler. Here is how I decided which memo and useCallback calls were safe to delete, how to find the components the compiler bailed out on, and how to catch regressions in CI.
Dev Tools2026-08-14
Your lockfile's dev/prod split won't tell you which licenses your app must credit
A record of classifying every dependency in a production project to decide what belongs on an app's license screen, and where the copyleft findings and the actual shipped artifact turned out to disagree.
Dev Tools2026-07-30
What Renovate may bump in an Expo app, and what it must never touch
Turning on automated dependency updates in a Rork-generated app also hands Renovate the 123 packages Expo SDK 57 pins. Measured on 2026-07-30, six of them sit a full major version behind npm latest. Here is how to generate the ignore list from the SDK instead of maintaining it by hand.
📚RECOMMENDED BOOKS
Build a Large Language Model (From Scratch)
Sebastian Raschka
LLM Dev
Prompt Engineering for LLMs
Berryman & Ziegler
Prompting
AI Engineering
Chip Huyen
AI Eng
* Contains affiliate links
See all →