WFile is a multilingual news publication covering public information from Japan, Korea, Thailand, Vietnam, and Indonesia. It publishes in Japanese, Korean, Thai, Vietnamese, Indonesian, and English.
At the time of writing, the archive contains 2,142 published language versions across 357 stories. The site is statically generated and served through Cloudflare. There is no application server sitting behind a search box.
I wanted search anyway: something readers could use to find a public notice by country, topic, language, or date, without adding Elasticsearch, Algolia, or a database query endpoint.
This is how the current version works.
The constraints
- Search everything, across six languages.
- Filter by country, topic, article language, and time range.
- Work on mobile.
- Keep the site static.
- Make filters shareable through the URL.
- Let readers save a search on their device.
- Give search engines a useful landing page, not an infinite set of query URLs.
The result is a compact static index plus about 300 lines of client-side JavaScript.
The index
The build already reads published articles from SQLite. A small build step writes a separate search index:
const rows = articles.map((article) => [ `${base}${articlePath(article)}`, article.title || '', article.summary || '', article.lang || '', article.region || '', article.section || '', article.topicKeys || [], String(article.published_at || article.updated_at || '').slice(0, 10), ]); The file is an array of arrays rather than an array of objects:
{ "meta": { "count": 2142, "fields": ["url", "title", "summary", "lang", "region", "section", "tags", "published_at"] }, "rows": [ ["https://wfile.org/en/...", "Title", "Summary", "en", "JP", "Local", ["local-government"], "2026-11-23"] ] } For 2,142 rows, the raw file is 1.8 MB. Gzipped over the wire, it is about 524 KB. It is loaded only on the search page, not on article pages.
That is not small enough to be invisible, but it is small enough to avoid a backend and still keep the article pages fast.
Searching without a search engine
The client fetches the index once, then normalizes each row:
function fold(value) { return String(value || '') .normalize('NFKD') .replace(/\p{M}/gu, '') .toLowerCase() .trim(); } Folding diacritics matters for Vietnamese and for readers typing without accents. It also makes Latin search more forgiving. For Japanese, Korean, and Thai, the same normalization is applied to both the query and the text, and matching falls back to substring checks rather than requiring a tokenizer.
The scoring is deliberately simple:
- exact title match: 120 points
- title starts with the query: 80
- title contains the query: 60
- summary contains the query: 24
- tags contain the query: 16
- section contains the query: 12
- token-level matches add smaller amounts
- a small recency boost keeps fresh notices visible
Filters run before scoring. The result list is sorted by relevance when there is a query, and by date when there is not.
Saved searches and shareable URLs
The current filter state is written to the URL with history.replaceState:
/en/tools/search/?q=Osaka&lang=en&country=JP&days=30 That makes a search easy to bookmark or send to someone else.
Saving is local-only:
localStorage.setItem('wfile-search-prefs-v1', JSON.stringify(state)); No account, no server-side profile, no email required. When a reader returns to the search page without query parameters, the last saved filters are restored.
This is a small feature, but it changes the tool from a one-off form into something readers can return to.
Rendering safely
Search results contain titles and summaries from the database. The renderer creates elements and assigns textContent rather than building HTML strings:
const heading = document.createElement('h2'); heading.textContent = row[1]; const summary = document.createElement('p'); summary.textContent = row[2]; No innerHTML for result content. It is simple, fast enough for 30 results at a time, and avoids turning a search index into an injection surface.
The SEO side
The search page is a normal indexable page:
- localized title and description
- canonical URL
- six-language hreflang set
-
WebApplicationandSearchActionJSON-LD - included in the sitemap
- linked from the header and footer
Query strings are client-side state, not separate server-rendered pages. The canonical URL stays on the tool landing page.
The underlying article metadata is also published as open data under CC BY 4.0:
What I would change next
The current index is a single global file. A larger archive would benefit from splitting it by language or sharding it by date.
The tokenizer is intentionally basic. Japanese, Korean, and Thai would benefit from proper morphological analysis if the archive grows much larger.
The UI currently renders 30 results at a time. That is fine for a first version, but virtualized rendering would be better for very large result sets.
For now, the tradeoff works: no search cluster, no API server, no per-query cost, and a search page that loads in a normal static build.
The full tool is at wfile.org/en/tools/search/. The dataset is at wfile.org/data/.
