Site search

A visitor types into the search box and sees products, categories and pages before they finish the word. A typo still finds the right thing. An item named exactly what they typed comes first. All of it runs inside the platform: no outside search service gets your catalogue or your visitors' queries.

What the visitor gets

Suggestions while typing. After two letters the box offers:

  • products, with picture, price and stock;
  • categories;
  • content: guides, documentation, pages;
  • the most searched queries of your site.

Arrows move through the list, Enter opens the highlighted item and Escape closes the list. The last row, See all results, opens the results page.

Every word is a prefix while typing. rel mod already finds Relé modul 8 kanálov.

Diacritics are optional. cerpadlo finds Čerpadlo, and ČERPADLO does too.

Codes are found however they are typed. A code joined by -, / or . is stored whole and by its parts. 879-3000, 8793000 and 879 3000 all find WAGO 879-3000. The same holds for ESP32-S3, esp32s3 and esp32 s3.

Typos are corrected.

  • One wrong letter is forgiven in a word of 4–7 letters, two in a longer word.
  • The results page then says Showing results for "hydraulicke" and offers Search instead for "hydraulikce".
  • A word still being typed is never treated as a typo.
  • A code is never "corrected" into another product's code. MFM385 does not answer with MFM384.

Phrases. Words in quotes must stand next to each other: "home assistant".

How results are ordered

Each word counts according to where it was found:

Where the word is Weight
The name highest
A code (SKU, part number, a text field named code, mpn, ean…) high
A category, brand or attribute (term references, list fields) medium
The body (descriptions, sections, attachments' names) low

On top of that:

  • the record named exactly what was typed comes first, and a name that starts with it comes next;
  • an item in stock moves up a little;
  • popular items move up a little.

So the board called ESP32-S3 is listed above a guide that only mentions the word forty times.

Sort orders. Results can be sorted by relevance, by price (low to high or high to low), by newest, or by name. The choice rides the address, so a sorted results page can be shared as it is.

Everything here belongs to the firm open in the toolbar and needs the Manage search permission. Claudia can do the same through her search tools.

Try a query. Type what a visitor would type and you see exactly what they get, in order, with the correction if one was made. On every result:

  • Pin first. The result is listed first for this exact query.
  • Hide. The result never appears for this query.

When the same result is both pinned and hidden, hiding wins.

Send a query to a page. For the same query you can enter an address on your site, for example cennik → /pricing/. The search box then goes straight there.

Rules lists every query you have pinned, hidden or redirected. Rules compare the query without case, diacritics or extra spaces, so Cenník and cennik are the same rule.

Synonyms are the words your customers use for the same thing:

Kind Example Effect
Both ways PLC, programovateľný automat either one finds both
One-way stykač, relé stykač also finds relays; relé finds only relays

A synonym may be several words. It then has to match as a phrase.

Weights set how much a word counts by where it was found: the name, a code, a category or attribute, or the text. They also set how much in-stock, popular and new items move up.

Index shows how many of the firm's records are searchable. Reindex this firm queues all of them, and the minute job works through the queue in the background.

What visitors search for

The What visitors search for card on the same screen shows the last 7, 30 or 90 days:

  • Totals: searches, searches that found nothing, clicks (with the click rate) and purchases that followed a search.
  • Most searched: click a query to see it in Try a query.
  • Found nothing: each row has an Add synonym box. Type what the query means, for example hydraulika → čerpadlo, and the next visitor finds it.
  • Found, but nobody clicked: the results exist but do not convince. Pin the right item or add a better name.

Privacy is built in:

  • Searches are counted only in visitors' browsers, never for robots.
  • A query that looks like an e-mail, a phone or a card number is stored as [redacted].
  • Searches are linked into one visit only when the visitor accepted optional cookies.
  • Raw searches are deleted after 90 days; only the daily totals stay.
  • Clicks from search in the last 30 days make an item popular, which moves it up a little in the results.

Filters on the results page

The results page has filters built from what was found: manufacturer, category, every attribute the products carry, and a price range.

  • Several values in one filter mean either. Different filters mean both.
  • Each number says how many results a tick would leave. Ticking one manufacturer never hides the others.
  • On a phone the filters fold under one Filters button. Changes there apply with Apply.
  • Everything is in the address, so a filtered page can be shared.

Freshness

A save does not wait for the search index. The record is queued, and the platform indexes queued records every minute (System → Settings → Cron, job Index saved records for search). The typo dictionary of each firm is refreshed every hour (job Refresh the search typo dictionaries).

Rebuilding a firm's whole index — after a large import, for example — is one command:

python manage.py search_rebuild --firm <machine name>

The assistant can do the same through its search_rebuild tool.

Per firm, always

Every index row belongs to one firm. A search, a suggestion or a typo correction only ever looks at the firm whose site is being searched, so one firm's products never appear on another firm's site. A record that is not public is never found, because search asks the same visibility rules as the pages do.

For developers

  • GET /api/v1/search?q=&lang=&page=&per_page=&sort=&f[<field>]=<value>&price_min=&price_max=&in_stock=
  • Several values for one field mean either. Different fields mean both.
  • The answer adds corrected, score, price, in_stock and image to the familiar envelope.
  • GET /api/v1/search/suggest?q=&lang= returns the grouped suggestions.
  • Anonymous answers of both are cached for a minute. Signed-in answers are never shared. Suggestions are limited to 120 a minute per browser address.
  • POST /api/v1/search/event, /click and /conversion are the browser's reports. A forged or foreign token stores nothing.
  • python manage.py search_bench --firm <firm> --queries <file> measures relevance and speed over a set of queries with known answers. It prints top-1, top-3, the share of queries with no result, and latency.
Теги
administrationsearchweb