Cart-Power Add-On: Smart Search

Smart Search for CS-Cart and Multi-Vendor

A customer who reaches the search box is ready to buy. If the search finds nothing, they leave — usually for a competitor.

The stock CS-Cart search matches a query against the beginning of a string in the database. It does not forgive typos, knows no synonyms, has no idea that a brand name typed in another alphabet is the same brand, and slows down noticeably as the catalog grows.

We have released an add-on that hands the search over to Elasticsearch and adds everything the stock one is missing.

More than search: listings, blocks and filters

In CS-Cart every product listing is built by a single core function, and on a large catalog it turns into a heavy database query. The add-on intercepts that function entirely, so the index serves not only search results but also category listings, product blocks and filter blocks. Check boxes in the settings decide what goes to Elasticsearch.

Measured on a live marketplace: a catalog of 779,000 products and 848,000 documents in the index. The same page was opened in two modes — normal and with the skip_elastic=Y key that turns Elasticsearch off for a single request. Every URL was unique, so no cache was involved either way; 18 paired runs, medians in the table.

What the customer opens On MySQL On Elasticsearch Gain
Category page 8.3 s 1.5 s 5.7×
Same category, page 200 8.0 s 1.4 s 5.6×
Filter by a feature 7.9 s 1.5 s 5.4×
Home page with product blocks 7.3 s 0.9 s 8.5×
Search by a word 18.1 s 1.1 s 17×

Catalog depth stops costing time: pages 3, 60 and 200 of a category all open in the same time on Elasticsearch — 1.47, 1.54 and 1.42 seconds — while on MySQL each of them costs about eight seconds.

Writing stays with MySQL: imports, ERP sync and price recalculations go to the database while the customer reads the index, so a nightly price feed no longer drags the storefront down.

What gets found now

The customer types Stock search Smart Search
cfvceyu — “samsung” on a Russian layout nothing Samsung products
a brand name typed in another alphabet nothing the brand’s products
televisin with a typo nothing televisions
telly nothing televisions, from the synonym dictionary
sneakers size 43 the size lives in a feature and is not searched sneakers in that size
a word in the middle of the name no match match


Wrong keyboard layout: cfvceyu is “samsung” typed with a Russian layout. 21 products found.


Another alphabet: a Cyrillic spelling finds Toshiba, and autocomplete offers the exact name.

What the store owner gets

Query analytics. What was searched for, how often, and what was found. Queries that returned nothing are listed separately: a direct list of what the catalog is missing, or of what is named differently from the way customers look for it.


Zeros in the “Found” column are a ready-made task list for the catalog.

Control over relevance. Weight and typo tolerance are set per field: name, product code, short and full description, meta tags, features.


The name is usually 100, descriptions 10–20, and the product code is matched exactly with no typo tolerance.

Dictionaries for your niche. Synonyms, stop words and prepared suggestions, with import and export. Morphology per language — each storefront language gets its own stemming algorithm. Relief for the database — product lists, product blocks and search move to Elasticsearch.

What the add-on does not do

  • It does not install Elasticsearch. The add-on connects to it; the server is yours.
  • It does not work without a scheduler. The index is kept current by cron jobs; without them new products never reach the results.
  • It does not restyle your store. The search layer is designed for UniTheme2; it works on other themes, but budget some time to fit it to your design.
  • It does not run alongside Cart-Power Live Search — enabling Smart Search disables that add-on automatically.

Compatibility

CS-Cart and Multi-Vendor 4.17.1 – 4.21.1, all four editions. PHP 7.4 – 8.3. Elasticsearch 8.x. Requires the Cart-Power: Add-ons Manager add-on.

See it and read it

Demo store: [redacted] — type cfvceyu or a misspelled product name into the search field and see what happens.

Ask your questions in this thread — we answer here.

The add-on on Marketplace: Smart Search & Catalog on Elasticsearch for CS-Cart — Cart-Power
The live demo and the documentation are linked on the same page.

Smart Search 2.1

The add-on has been updated. The focus of this release is the search window: customers can narrow the results more easily and never hit a dead end.

What’s new

  • A category panel in the search window. Two views: a category list with the number of hits and a filter with checkboxes to pick several categories at once. With both enabled, the window shows a switcher.
  • A “nothing found” screen. Instead of an empty window the customer gets a hint, popular queries and the store’s categories.
  • An Appearance settings tab: window layout, panel views, the number of categories in the panel and products per group.
  • Styling from your theme. The search window takes button colours, background, text colour and the main font from the store theme.
  • A tidier “Often searched” block. Variants of one query in another case, keyboard layout or transliteration are merged, typos are shown corrected, and an unsuitable query can be hidden with one action in the search history.
  • Elasticsearch 9.x is supported alongside 8.x, and the index replica count follows the number of nodes: on a single server the indices are no longer yellow.
  • Fixed: on Ultimate 4.17.1 and newer, category and company synchronisation failed with a database error; queries from the search results page, and every query after the first in one window session, were not recorded in the history; sorting on the search results page was not applied.

The category panel: each category shows its number of hits, products are split into groups.

The category filter: ticked categories narrow the results without closing the window.

Nothing found — the customer sees popular queries and categories.

Compatibility

CS-Cart and Multi-Vendor 4.17.1 – 4.21.1, all four editions. PHP 7.4 – 8.3. Elasticsearch 8.x or 9.x. The update arrives through the Cart-Power Add-ons Manager; settings and the Elasticsearch password are kept.

A demo, the documentation and the full changelog are on the add-on page on the Marketplace:

Smart Search 2.2 and 2.3: customers narrow the results without leaving the search window

Two updates in a row — 2.2 and, following feedback, 2.3. Almost all of it is about the search window itself. Until now a customer could only look at what was found and jump to a category; now they narrow the results right where they are.

Price and brand filters. Two plain expanded filters now sit in the left column under the categories: price with “from” and “to” fields — the bounds come from the cheapest and the most expensive of the products found — and the brands of those products, each with its own count. Results are recalculated in place, with no trip to the results page. Both filters have their own setting: brands come from the brand product feature, and price is off by default.

Price and brand under the category list: the results narrow without closing the window.

On a phone the filters never cover the products. Categories, price and brand collapse into a row of buttons above the results; a button expands its own block, only one is open at a time, and picking a category or applying a filter collapses it again. The products are visible from the first screen.

Phone: the filters as buttons; “Categories” is tapped and the list opens under the row.

Dense list. The grid of cards now has a companion view: one row with the thumbnail, name, product code, stock, price and the “Add to cart” button. Twice as many products fit on the screen. The view is switched in the results header and remembered per visitor, and which view the window opens on is a setting.

The same query as a list: more products at a glance, each with its price and stock.

Hints. Hints from the search phrases you set up and from the query history are shown in one row together with autocomplete from product names: the typed part in regular weight, the continuation in bold. A click inserts the hint and runs the search. The phrases themselves are managed in the admin panel: “CP: ElasticSearch → Search phrases”.

Correction line. When the add-on has corrected the query — a typo, a wrong keyboard layout or a brand written in another alphabet — a line above the results says which query they are for, and one click takes the customer back to their own spelling. Matches in the names of the products found are highlighted.

More precise on multi-word queries. Transliteration no longer brings products into the results that match only one word out of three or more: “T-shirt, Colour: Black” keeps the T-shirts instead of everything black.

Voice search. The search field has a microphone button: the browser recognises the speech itself, no audio is sent to the server, and the language follows the storefront. Browsers without speech recognition simply show no button.

Keyboard and small things. The window is fully operable from the keyboard: “/” opens the search, arrows walk through suggestions and products, Enter opens the selected item, Esc closes the window. The full-width window slides in smoothly from the top, and the number of hits sits in the window header. If search does not respond, the window says so and offers a “Retry” button.

Compatibility is unchanged: CS-Cart and Multi-Vendor 4.17.1 – 4.21.1, all four editions, Elasticsearch 8 and 9. The update installs through the upgrade centre.

The live demo and the documentation are on the add-on page in Marketplace: Smart Search on Elasticsearch for CS-Cart — Cart-Power

Questions about these versions are welcome in this thread.

Smart Search 3.0: product promotion in search

We have released version 3.0 of the Smart Search add-on. The main change is product promotion in search: you decide which products customers see first for chosen queries, and which products are not shown for those queries at all.

What customers see. Pinned products go first in the order you set and get into the results even if their names do not contain the query words. In the search window the category group of a pinned product moves up too. Excluded products are not shown for these queries, neither in the results nor in autocomplete suggestions.

For the query “tv” the 610 Series LCD TV goes first — a promotion rule pinned it.

Rules. The admin panel has a new “Product promotion” page (Website → CP: ElasticSearch). A rule sets the queries, the pinned products with their positions and the excluded products. A query matches a rule exactly, by its beginning or anywhere, including after the add-on fixes the keyboard layout or transliteration. A rule has an active period, a position among rules and a hit counter.

A promotion rule: queries, match type, the pinned product and the rule position.

Where it works. Rules work on the search results page and in the search window. Storefront filters work as usual, and when a customer picks a sorting, pinned products follow the common order. Rules do not apply to categories and product blocks.

The add-on works with CS-Cart and Multi-Vendor 4.17.1–4.21.1 and Elasticsearch 8 and 9. The upgrade is available in the Add-ons manager and in the Upgrade Center. The live demo and the documentation are on the add-on page in the Marketplace.