● A free public tool  ·  Built by Poptani Labs  ·  No sign-up  ·  Your data never leaves your browser
Built in the Lab · 5-minute read

How this site's search actually works (no server, no database)

A wooden card catalogue with rows of small drawers in a library
Image: '2006 228450201 card catalog.jpg' by Beatrice Murch from Buenos Aires, Argentina, CC BY 2.0, via Wikimedia Commons

Every page on this site has a search box in its header, and the search page finds things fast — finance calculators, blog posts, cricket tours, guides — with no sign-in and no server doing the work. There is no search engine running anywhere behind this site. The whole thing is a single data file and a short piece of code that runs in your browser. This post describes the real implementation, read from the actual code that builds and runs it — no simplification for effect, and no part of it invented.

A card catalogue, rebuilt by hand

The heart of the system is an index: one file that lists every searchable page on the site — currently 194 entries — with each page's title, a short description, its address, a category, and a set of extra keywords. The index is built by a small script that walks through every page on the site and reads the title and description straight off each page, so the index can never drift out of date with the pages themselves. It is re-run whenever a new hub, blog post, or top-level page is added — the latest rebuild, after today's batch of six posts, brought the count to 194. The script makes two deliberate exclusions. The verification file for the search console is left out, and the old cricket tour redirect is left out, because neither is a destination a visitor would want. The bigger exclusion is the fund pages: this site has hundreds of individual fund pages under the SIP and SWP calculators, and a search for "SIP" would otherwise return a wall of near-identical fund pages instead of the calculator itself. So those pages are excluded from the index and grouped under the two calculator hubs, which carry extra keywords — mutual fund, retirement, monthly income — so fund-related searches still land on the right tool. A specific fund is found through the fund search inside the calculators, not through the site search.

How a search is scored

When you type a query on the search page, your browser downloads the index file and does all the work locally — nothing is sent to a server, and the search keeps working offline once the page and the index have loaded. The query is split into words, and a page only matches if every word appears somewhere in its title, description, category, keywords, or address. Matching pages are then scored: a word in the title is worth three points, in the keywords two, in the description one, and half a point if it only appears in the address or category. Results are sorted by score, then alphabetically, and the first fifty are shown. There is also a small star button on every result that saves the page to your Reading List — that part is handled by the same reading-list code that powers the save buttons across the site. The whole search is under a hundred lines of code. It has no spelling correction, no synonyms, and no ranking model. It finds what you asked for, in the order the site itself thinks matters, and stops there.

The "AI" problem

Here is the fun anecdote — a bug that is still visible in the code, in the form of the fix it caused. Early on, searching for "AI" returned strange results: pages about chains, and pages where someone "said" something, ranked above the actual AI articles. The reason is embarrassingly simple. The search matches substrings, and the letters "ai" appear inside "chain" and "said" — so a two-letter query matched almost everything. The fix was a whole-word bonus: if the search term appears as a complete word in the title, the page gets two extra points; a complete word in the description gets one. That is the entire solution, and it works because the problem was never mysterious — it was a two-letter word hiding inside longer ones. It is the kind of bug that only a site with a category called "AI, Decoded" would ever notice, and the kind of fix that only takes ten minutes once you see it. The fund-page grouping above came from the same kind of thinking: the search was never broken, it was just answering a slightly different question from the one visitors were asking, and the fix was to change what the index contains rather than to make the search cleverer.

Under the Hood

The search on this site is deliberately boring: a list of pages, rebuilt when pages are added, matched and scored in your browser, with nothing sent anywhere. There is no server to maintain, no database to back up, and no query log to protect — because there is nothing to log. The two interesting decisions in it are both about what is left out: the fund pages, so a search finds the tool instead of 354 copies of it, and the substring trap, so “AI” finds the AI articles instead of the word “said”. Good search, it turns out, is mostly good curation — deciding what belongs in the catalogue, and what does not.

Related on Poptani Labs: Inside the nightly blog pipeline: how this post got written, checked and published, Inside the SWP Simulator: how a retirement withdrawal plan is actually calculated, How GPS works: atomic clocks in space, Einstein, and a tragedy. More in this category: Built in the Lab.

Sources: Search this site (Poptani Labs), Explore the site (Poptani Labs), Reading List (Poptani Labs)

← All posts