Skip to main content
Back to blog

Algolia vs. Solr: Choosing a Search Engine for E-commerce

A practical comparison of Algolia and Solr for product search — cost, relevance tuning, operational overhead, and when each one wins.

3 min read

Product search is one of the few areas where "just use the database" stops working early — LIKE '%query%' on MySQL falls apart well before a catalog reaches ten thousand products. I've shipped both Algolia and self-hosted Solr for e-commerce search. Neither is universally better; they optimize for different constraints.

What each one actually is #

Algolia is a managed, hosted search-as-a-service. You push records to an index via API, configure ranking/facets through their dashboard or API, and query a global CDN of search servers. No infrastructure to run.

Solr is a self-hosted (or self-managed-in-the-cloud) search engine built on Lucene. You control the schema, the ranking function, and the infrastructure — and you're responsible for all of it.

Where Algolia wins #

  • Time to first working search. A basic instant-search experience with typo tolerance and faceting can be live in a day.
  • Operational overhead. No servers, no JVM tuning, no shard management.
  • Frontend tooling. InstantSearch libraries handle a lot of UI complexity (facets, pagination, highlighting) that you'd otherwise build by hand.
import algoliasearch from "algoliasearch";
 
const client = algoliasearch("APP_ID", "SEARCH_KEY");
const index = client.initIndex("products");
 
const { hits } = await index.search("wireless headphones", {
  facetFilters: ["category:electronics", "inStock:true"],
});

The tradeoff is cost, which scales with records and search volume, and less control over the exact ranking algorithm — Algolia's relevance model is powerful but works within its own ranking framework rather than a fully custom scoring function.

Where Solr wins #

  • Cost at very large catalogs. Once you're indexing millions of SKUs with high query volume, self-hosted infrastructure is often cheaper than a managed per-record, per-query pricing model.
  • Full control over ranking. Custom bf/boost functions, field-level analyzers, and synonym handling tuned exactly to your catalog's language and structure.
  • Data residency. For clients with strict requirements about where product/customer data lives, self-hosting removes the question entirely.
# Solr query with custom boosting
q=headphones&bf=recip(ms(NOW,last_modified),3.16e-11,1,1)&fq=in_stock:true

The tradeoff is operational: you own uptime, capacity planning, and reindexing strategy (delta imports vs. full reindex), and relevance tuning requires real Lucene/Solr expertise on the team.

A middle path

For projects that need more control than Algolia offers but don't want to run Solr infrastructure, managed Elasticsearch/OpenSearch services occupy a middle ground — self-hosted-grade ranking control with someone else managing the cluster.

The question I actually ask clients #

Not "which is better" but: do you have (or want) the operational capacity to run a search cluster? If yes, and the catalog is large enough that per-record pricing adds up, Solr pays for itself. If the team wants to ship a great search experience without adding infrastructure to maintain, Algolia is very hard to beat on time-to-value.

Lessons learned #

I've migrated a client from Solr to Algolia to cut operational overhead, and I've migrated another from Algolia to Solr as catalog size and query volume made the managed pricing model more expensive than running infrastructure. Both migrations were the right call for that specific business — which is the actual takeaway: this is a cost/control tradeoff, not a quality one.

What actually changes — and what doesn't — when you move a content-heavy WordPress site to a headless setup with a REST/GraphQL frontend.

Practical techniques for keeping WooCommerce fast under real traffic — from database indexing and object caching to queue-based order processing.

Where PHP applications actually lose time in production, and the concrete fixes I reach for before considering a rewrite.