A customer types the title of a piece you sell and gets "No results". They do not try again. They go to a competitor, or call customer service, or give up. On publisher and catalogue sites, a zero-result rate of 10 to 20% is common, and most of those searches are for things that are in the catalogue.
If your site runs on Elasticsearch, almost all of this is fixable without replacing it. These are the five causes we see most often.
First, measure it
Before changing anything, log every search with its number of results. A week of logs tells you:
- the zero-result rate: share of searches with no results;
- the top 100 zero-result queries, which are your to-do list;
- how many of those are typos, product codes, names or things you really do not sell.
Without this, tuning is guesswork.
1. No typo tolerance
amazing grase, hallelujha, tchaikovksy. A default match query needs the exact words. One wrong letter, no result.
Fix: allow fuzzy matching, but rank exact matches above fuzzy ones.
{
"bool": {
"should": [
{ "multi_match": { "query": "amazing grase", "fields": ["title^3", "composer^2", "description"], "type": "best_fields", "boost": 2 } },
{ "multi_match": { "query": "amazing grase", "fields": ["title^3", "composer^2"], "fuzziness": "AUTO", "prefix_length": 1 } }
]
}
}
prefix_length: 1 stops the first letter from being "corrected", which keeps results sensible and queries fast.
2. Every word must be in one field
easy christmas satb fails when "christmas" is in the title, "satb" is in the voicing field and "easy" is in the difficulty field. With best_fields and operator: and, no single field has all three words.
Fix: use cross_fields, which treats the fields as one big field for matching:
{
"multi_match": {
"query": "easy christmas satb",
"fields": ["title^3", "composer^2", "voicing", "difficulty", "season"],
"type": "cross_fields",
"operator": "and"
}
}
cross_fields does not support fuzziness, so combine it with the fuzzy query from fix 1 in a bool, as separate should clauses.
3. Plurals, accents and word forms
hymns does not match hymn. Dvorak does not match Dvořák. arrangements does not match arranged.
Fix: an analyzer with stemming and accent folding on the text fields:
"analyzer": {
"catalogue_text": {
"tokenizer": "standard",
"filter": ["lowercase", "asciifolding", "english_possessive_stemmer", "light_english_stemmer"]
}
}
Define both as stemmer filters: english_possessive_stemmer with "language": "possessive_english" and light_english_stemmer with "language": "light_english". Light stemmers are less aggressive, which matters for titles and names. For composer and author names, also see composer and author name variants.
4. Words your customers use, but your catalogue does not
Customers search for xmas, easter anthem, kids choir or band grade 2. Your catalogue says Christmas, Lent and Easter, children's choir and level II.
Fix: a synonym list, built from your zero-result log and edited by your staff, not a developer:
PUT _synonyms/catalogue
{
"synonyms_set": [
{ "id": "xmas", "synonyms": "xmas, christmas" },
{ "id": "kids", "synonyms": "kids choir, children's choir, youth choir" },
{ "id": "grade2", "synonyms": "grade 2, level 2, level ii" }
]
}
Apply it in the search analyzer with a synonym_graph filter set to "updateable": true, and changes take effect without reindexing.
5. Product codes and ISBNs split into pieces
G-10234 or 978-1-62277-123-4 typed into the search box gets split on the hyphens into numbers that match random products, or nothing at all.
Fix: a separate normalised field for codes, searched first. This one deserves its own article: searching ISBNs and catalogue numbers.
Then check the filters
Sometimes the search works and a filter hides the result: out-of-print editions excluded by default, a site that only shows one imprint, or a digital-only filter left on. Run your zero-result queries with all filters off. If they find results, the problem is the interface, not the search.
Running an old Elasticsearch?
All of the above works on supported versions. If your site runs on Elasticsearch 5, 6 or 7, some of it (like the synonyms API) needs an upgrade first. See upgrading an old Elasticsearch on a legacy website.
We do this for music, book and educational publishers: a fixed-price review of your real searches, then tuning on the Elasticsearch you already run. See catalogue search for publishers.
