Relevance tuning
Shoof AI’s defaults work well for most stores and blogs. When they don’t, this page explains what decides the order of results and which setting changes what.
After each change, try your important queries in the dashboard’s Search preview, which shows why each result is where it is: its keyword and semantic rank, pin and learned boost.
How a search is ranked
Section titled “How a search is ranked”- Rules that match the query apply first: they can rewrite the query, add filters, and pin or hide results.
- Keyword search scores records with BM25 across the searchable attributes, with their weights, typo tolerance and synonyms.
- Semantic search finds the records whose meaning is closest to the query.
- Fusion merges the two lists with reciprocal rank fusion: a record high in both lists beats one at the top of only one.
- Ranking signals and recency lift records by popularity, rating, your own signals, and freshness.
- Learned ranking lifts results visitors clicked and bought for this query.
- Pins from rules take their positions.
Searchable attributes
Section titled “Searchable attributes”searchableAttributes lists the fields keyword search looks in, with a weight
from 0 to 20. A match in a heavier field counts for more. The defaults:
| Field | Weight |
|---|---|
sku |
8 |
title |
6 |
brand |
3 |
categories |
3 |
tags |
2 |
attributes_text (all attributes together) |
2 |
excerpt |
1.5 |
content |
1 |
You can also add author, text and keyword custom fields
as fields.<name>, and single product attributes as attributes.<key> (up to
20), such as { "field": "attributes.color", "weight": 3 }. Only the attribute
keys listed here are indexed on their own, so after adding one, send your records
again (full resync).
A field with weight 0, or left out, isn’t searched by keyword search, but still counts for semantic search if it’s a semantic attribute.
curl -s -X PATCH "https://api.shoofai.co/v1/apps/$SHOOF_APP/settings" \ -H "x-shoof-api-key: $SHOOF_ADMIN_KEY" -H "content-type: application/json" \ -d '{ "searchableAttributes": [ { "field": "title", "weight": 6 }, { "field": "sku", "weight": 8 }, { "field": "attributes.color", "weight": 3 }, { "field": "content", "weight": 0.5 } ] }'Semantic attributes
Section titled “Semantic attributes”semanticAttributes lists what’s embedded for semantic search, after the title,
which always comes first. The default is brand, categories, attributes,
excerpt and content; apps on the blog preset
use categories, tags, author, excerpt and content. You can add tags,
author, sku, custom fields (fields.<name>) and single attributes
(attributes.<key>). attributes embeds every attribute together, as
color: Black; size: 42; a single attribute is embedded under its
declared name where it’s listed, and attributes
then leaves it out.
Embed what describes the item. Leave out what doesn’t, such as boilerplate text repeated on every product. A change reaches each record the next time it’s sent, when it’s embedded again.
GET /fields/coverage counts the records that have each field the settings can
name: these, the other built-in fields (title, attributes_text, price,
rating, date and the rest), your custom fields and
declared attributes, the ranking.<name>
signals records have sent, and any other attributes.<key>, ranking.<name>
or meta.<key> the settings name:
{ "records": 1204, "fields": { "brand": 1180, "sku": 0, "fields.material": 312, "attributes.color": 950 } }The dashboard’s Relevance pages pick fields from these, by name, with the counts, and leave out the built-in fields no record has, so a blog doesn’t offer SKUs or prices. A saved row for such a field stays in the settings, hidden, and shows again once records have the field. Declared attributes and custom fields are always offered, since records may not send them yet.
Ranking signals
Section titled “Ranking signals”customRanking lifts records by numeric fields: popularity, sales, rating,
margin, anything you send. Each signal has a factor (0 to 10) and a
modifier:
log1p(the default):log(1 + value), so the first few hundred sales matter more than the next few thousand;sqrt: a gentler curve;none: the value as it is.
A record’s score is its relevance times 1 + Σ factor × modifier(value), so
signals reorder relevant results rather than surfacing irrelevant popular ones.
In hybrid and semantic search it multiplies the fused ranking, after keyword and
meaning results are combined. A record with none of the fields, such as a post
among products, gets the average multiplier of the others, since having no
sales says nothing about how good a match it is. The defaults:
{ "customRanking": [ { "field": "boost", "factor": 0.1, "modifier": "none" }, { "field": "popularity", "factor": 0.15, "modifier": "log1p" } ]}Any number field can be a signal: popularity, boost, rating,
review_count, price, your own ranking.<name> values, and number custom
fields (fields.<name>). To favor high-margin products, send
"ranking": {"margin": 0.42} with each record and add
{ "field": "ranking.margin", "factor": 0.5, "modifier": "none" }.
Recency
Section titled “Recency”recency favors newer items, for news, blogs and new arrivals. It’s off by
default.
{ "recency": { "weight": 0.2, "halfLifeDays": 30, "field": "date" } }weight(0 to 5, 0 is off) is what an item dated now gains; it halves everyhalfLifeDays(30 by default) of age.fieldis the date it goes by:date(the default),modified, or a date custom field such asfields.event_date. Items without it gain nothing.
In fused rankings, scores sit close together, so small weights go a long way: 0.1 moves a new item up a few places, and 1 puts most new items first. Start around 0.2. An explicit sort ignores recency.
Typo tolerance
Section titled “Typo tolerance”{ "typoTolerance": { "enabled": true, "minWordSizeFor1Typo": 4, "minWordSizeFor2Typos": 8, "allowOnNumbers": false, "disableOnWords": ["asics", "puma"], "disableOnAttributes": ["brand"] }}- Words shorter than
minWordSizeFor1Typo(4 letters) must match exactly. Words ofminWordSizeFor2Typos(8) letters or more may have two typos. - Words with digits match exactly, so model numbers like “a54” don’t match
“a34”, unless
allowOnNumbersis on. disableOnWordslists words that must always match exactly: brand names, jargon, words that are one typo away from another product.disableOnAttributesturns typos off in some fields:title,content,excerpt,attributes_text,categories,tags,brand,author,attributes.<key>and text or keyword custom fields.skualways matches exactly.
"typoTolerance": false turns typos off everywhere.
Hybrid weights
Section titled “Hybrid weights”| Setting | Default | Does |
|---|---|---|
mode |
hybrid |
The default mode: hybrid, lexical or semantic. |
lexicalWeight |
1 | The keyword list’s weight in fusion, 0 to 5. |
semanticWeight |
1 | The semantic list’s weight in fusion, 0 to 5. |
rrfK |
60 | Fusion’s rank constant. Lower values favor the top of each list more. |
semanticCutoff |
0.5 | How close in meaning a record with no keyword match must be to be returned, from 0 (anything) to 1 (only the closest). |
semanticMinScore |
An absolute similarity floor for semantic matches, 0 to 1. |
If semantic search brings in loosely related items, raise semanticCutoff or
lower semanticWeight. For catalogs where exact names matter most, such as spare
parts, raise lexicalWeight.
semanticCutoff is relative: it’s a fraction of the way from the 10th-best
semantic match up to the best, so it adapts to each query rather than needing
a fixed similarity score.
Filtering by language
Section titled “Filtering by language”filterByLang (on by default) returns only records in the search’s lang. Turn
it off to search every language at once, such as on a site whose records aren’t
tagged with a language.
Measure, don’t guess
Section titled “Measure, don’t guess”- Search preview in the dashboard runs searches against your app, with a language and mode switch, and shows each result’s ranking info.
- Analytics lists your top queries and queries with no results: start tuning with those.
rankingInfo: trueon a search shows each hit’s keyword and semantic rank, pin and learned boost.