Building world-class product search at Shopify: Where C++ excellence meets ML innovation

Mikhail Shakhray12 Nov 2025

Problem

Commerce search must answer in milliseconds for billions of queries (the post names Black Friday Cyber Monday). Data scientists, meanwhile, want to ship new rankers daily. A pure C++ ranking layer is fast but slow to change. Python or Java speeds up iteration but adds latency and memory overhead at this query volume. Python calling C++ brings deployment complexity and version skew between the two parts.

Example from the article: Shopify's search serves millions of merchants and combines typo correction, synonyms, faceting and semantic search. Its CatBoost, LightGBM and transformer rankers must run at native C++ speed, yet data scientists deploy changes without C++ expertise.

Solution in brief

Shopify wrote RankFlow, a Python-like domain-specific language (DSL) in which data scientists describe features and model calls, and executed it in a C++ engine: first SimScorerDSL, then the faster TurboDSL, both behind the same DSL syntax, so users never had to migrate. The author says models trained on billions of queries deploy in minutes. Every pull request gets an automatic timing comparison.

Questions this case answers
  • How to let data scientists change ranking models and features daily when serving code must run at compiled-language speed under a tight latency budget
  • How to catch latency and relevance regressions of a ranking change before it reaches production
  • How to put transformer, neural and gradient boosting rankers into a search engine that must answer in milliseconds?
  • How to let data scientists ship new ranking logic daily without writing C++?

Tools and methods

  • RankFlow (DSL) — declarative description of ranking modules: features, text matching, model inference.
  • SimScorerDSL / TurboDSL — the first and the second C++ execution engines for the DSL.
  • CatBoost / LightGBM — gradient boosting rankers trained on historical queries.
  • Transformer neural ranker (ONNX) — semantic ranker, ensembled with the boosting model.
  • Per-PR performance analysis — component timings and result comparison, ±2% tolerance.
Continue reading — it's free

Google or a one-time email code. No password.