How it works

How search-as-you-type works in a notes app

Why a notes app can find one note among thousands after two letters: indexes, prefixes, ranking and tags, explained with Note Base as a worked example.

Plugpixels Editorial TeamTechnology 5 min read
A library card catalogue drawer open beside a laptop, with a hand typing and index cards fanned out on the desk

Type two letters into the search box of a good notes app and the list shrinks to the right note before you have finished the word. That speed is not luck. Note Base, a note taking app whose search looks through titles, text and tags as you type, is a handy example of what is happening underneath.

This explainer covers what an index is, how search-as-you-type works, why some searches miss notes you know exist, how tags and search work together, and how to write notes that are easy to find again.

What happens when you type into a search box?

The naive way to search would be to open every note and read it from start to finish looking for your word. With a handful of notes that is fine. With thousands of long notes, doing it on every keystroke would make a phone stutter.

So most apps do the reading in advance. Whenever a note is saved, the app updates a separate structure, an index, that records which words appear in which notes. A search then only has to look up your word in the index, which takes a fraction of the time.

What is an index, and why is it so fast?

Think of the index at the back of a book. Instead of reading the whole book for “photosynthesis”, you look it up alphabetically and get a list of page numbers. A search index, often called an inverted index, works the same way: each word points to the notes that contain it.

Building the index involves a few clean-up steps. Text is split into words, called tokens. Capital letters are usually folded to lower case, and accents are often normalised, so “Café” and “cafe” match. Some systems also reduce words to a common stem, so “running” finds “run”.

  • Tokenise: split “Lemon pasta, quick!” into lemon, pasta, quick.
  • Normalise: lower case, and often strip accents and punctuation.
  • Store: record that each word appears in this note, and where.
  • Look up: at search time, match your letters against the stored words.
A tag is a word you choose on purpose, so it is the most reliable thing to search for.

How does search work while you are still typing?

Search-as-you-type relies on prefix matching. After “le”, the app looks for every indexed word that starts with those letters: lemon, lecture, letter. Because the index is sorted, all those words sit next to each other, so the lookup stays quick. Each new letter narrows the set.

Results are then ranked. A match in a note’s title usually counts for more than one buried in the tenth paragraph, and a match on a tag is a strong signal of what the note is about. Many apps also wait a few milliseconds after your last keystroke before searching, so they are not doing work for letters you are about to replace.

Searching on the device rather than on a server has another benefit: it works with no connection.

Why does search sometimes miss a note you know exists?

Usually because the word in your head is not the word in the note. You search “doctor” and the note says “GP”. Strict search engines only find what is literally there, while some add typo tolerance or synonyms. Text inside a photo or a scanned PDF is invisible to search unless the app has read it with character recognition first.

Tags solve much of this. A tag is a word you choose on purpose, so it is the most reliable thing to search for.

How do tags and search work together?

Note Base, a simple note taking app made by Galveo, combines the two. Each room works like a notebook, and its search looks through titles, text and tags while you type; on the Home screen one search covers all your rooms together. Inside a room you can narrow the list to a single tag, and because a note can carry several tags, it appears under each of them. That gives you a notes app with folders feel without folders inside folders.

It runs on iPhone, iPad, Android and Mac, and notes open and take changes offline. Note Base is a notes app free to download, which covers writing, formatting, tags, search and sharing a room, so it works as a shared notes app or a journal app too. Premium adds sync, making it a notes app that syncs across devices for people who write on a phone and read on a Mac. The FAQ lists what each plan covers.

How do you write notes that are easy to find again?

Search works best when you help it. A few habits make a large archive feel small, whether you use a notebook app on a tablet or a notes app on Android:

  • Give every note a specific title: “Boiler service, March” rather than “Notes”.
  • Use the words you will search for, not only abbreviations.
  • Add two or three tags: a topic, a project and a status.
  • Put dates in the title for journals, meetings and trips.
  • Keep each note about one thing, so search returns one clear answer.

Frequently asked questions

How does instant search work in apps?

+

The app builds an index of words when notes are saved, then matches the letters you type against the start of indexed words. Because it only looks up the index rather than reading every note, results appear almost immediately.

What is an inverted index?

+

It is a list of words, each pointing to the documents that contain it, like the index at the back of a book. Search engines and many apps use it to find matches quickly.

Why can my notes app not find a word in a photo?

+

Search reads text, not images. Words in a photo or scan are only searchable if the app has converted them to text with character recognition.

Is search better than folders for finding notes?

+

For finding a specific note, search is usually faster. Folders or notebooks help you browse a topic. Many people use a few notebooks, tags inside them and search for everything else.

Which notes app searches titles, text and tags as you type?

+

Note Base does: each room’s search covers titles, text and tags while you type, and the Home screen search covers every room at once.

Instant search is an index doing its job: words recorded when you save, prefixes matched as you type, and titles and tags ranked first. Give your notes clear titles and a few good tags, and two letters will be enough.

How we research: Guides are written from established sources and checked for accuracy. They are general information, not professional advice.

Written by

Plugpixels Editorial Team

Technology

Our writers have spent years taking devices apart, on the bench and on paper, and explain them in plain language.

More Stories

View all →