HTML5 game publishing
Add Search to Your Games Section Without a Search Engine
Build a fast games search from the PlayKovo feed: cached index, ranking, accents, synonyms, no-result handling and noindex.
Once a games section grows past a few dozen titles, visitors stop scrolling and start looking for something specific: "car", "puzzle", "2 player", a game name they heard from a friend. Without search, they leave. This post explains how to add a simple, fast search to a games section built from the PlayKovo feed, without a search service or a database.
Why a small site does not need a search engine
A catalog of a few hundred or even a thousand games is small data. The whole list, with titles, short descriptions, categories and tags, fits in a JSON file of a few hundred kilobytes. A browser can search that in well under a millisecond. You do not need Elasticsearch, Algolia or a database query for every keystroke.
The simplest working setup is:
- Fetch the feed on your server and cache it.
- Build a small search index from the fields you need.
- Send that index to the page, or search it on the server.
- Match the query and show results as the visitor types.
Step 1: fetch and cache the feed
The PlayKovo feed is available as JSON or XML at /api/embed-games on playkovo.com, and it is cached for five minutes on PlayKovo's side. Fetch it on your server, not from each visitor's browser, and store a copy. Refreshing once an hour or once a day is plenty for search.
When you refresh, also remove games that are no longer in the feed. A search result that leads to a removed game is a bad experience. Separate posts on the developers and partners blog cover the feed fields and caching in more detail.
Step 2: build a small index
Keep only what search and the result list need. For each game, store:
- The slug (to build the link to your own game page).
- The title.
- Category and tags.
- The short description, if you want to match words inside it.
- The thumbnail URL, for the result list.
Then normalize the searchable text once, when you build the index, not on every search:
const norm = s => s
.toLowerCase()
.normalize('NFD')
.replace(/[̀-ͯ]/g, '') // remove accents
.replace(/[^a-z0-9]+/g, ' ')
.trim();
const index = games.map(g => ({
slug: g.slug,
title: g.title,
thumb: g.thumbnail,
t: norm(g.title),
k: norm([g.category, ...(g.tags || [])].join(' ')),
d: norm(g.short_description || ''),
}));
Removing accents means a visitor typing "pokemon" also matches "Pokémon", and a visitor in Turkey typing "araba" without special characters still finds what they want. Check the actual field names in the feed you receive, since they may differ from the names used in this example.
Step 3: rank the matches
A plain "contains" check finds results but ranks them badly. A simple scoring system works much better:
function search(q) {
const words = norm(q).split(' ').filter(Boolean);
if (!words.length) return [];
return index
.map(g => {
let score = 0;
for (const w of words) {
if (g.t.startsWith(w)) score += 10;
else if (g.t.includes(' ' + w)) score += 7;
else if (g.t.includes(w)) score += 4;
else if (g.k.includes(w)) score += 3;
else if (g.d.includes(w)) score += 1;
else return null; // every word must match somewhere
}
return { g, score };
})
.filter(Boolean)
.sort((a, b) => b.score - a.score)
.slice(0, 24);
}
The rules are simple: a match at the start of the title counts most, a match in the title counts more than one in the tags, and a match only in the description counts least. Every word in the query must match somewhere, so "car parking" does not return every car game.
Step 4: handle typos and synonyms
Real visitors type "parkng", "2 player" when the tag says "two player", or "shooting" when the category says "shooter". You can handle most of this cheaply:
- A synonym table. A short list mapping common variants: "2 player" to "two player", "shooting" to "shooter", "cars" to "car". Expand the query with these before searching.
- Simple plural handling. Strip a trailing "s" from words longer than three letters, both in the index and in the query.
- A small typo fallback. If a search finds nothing, try again with words that are one letter different from the query (edit distance of 1) in titles only. Do this only when there are no exact results, so it does not add noise.
Look at what people actually search for. Log the queries (without any personal data) and check which ones return zero results. That list tells you exactly which synonyms to add, and sometimes which games your visitors want that you do not have yet.
Step 5: the search box itself
- Debounce input by about 150 ms so you do not redraw results on every key press while someone types fast.
- Show results as a grid of thumbnails, the same as the rest of your games section. Visitors recognize games by their pictures.
- Always show something. If there are no results, show popular games or the category that best matches the query, with a short message.
- Make it work without JavaScript. Use a normal form with a
qparameter, so the server can render results too. This helps accessibility and gives you shareable result URLs. - Use a proper label. A visible label or
aria-labelon the input, and make sure results can be reached with the keyboard.
Should search result pages be indexed?
Generally no. Search result pages for arbitrary queries create endless thin pages, and Google's guidelines advise against letting internal search results be crawled. Add noindex to them. If you want pages for popular topics like "car games", build real category or tag pages with your own text instead. There is a separate post about building category and tag pages from the feed.
Lazy-load the games, not just the search
Search results should link to your game pages, not open twenty embeds at once. Show thumbnails in the results and load the game iframe only on the game page, or when the visitor clicks play. That keeps the search page fast.
A short checklist
- The index is built on the server from a cached copy of the feed.
- Removed games disappear from the index on the next refresh.
- Titles rank above tags, and tags above descriptions.
- Accents, plurals and a few common synonyms are handled.
- No-result searches show helpful suggestions and are logged.
- Result pages are
noindex.
The full catalog is on the PlayKovo games page, and the partner documentation is linked from the developers and partners section.


