SolrCloud and distributed search with Apache Solr

Table of Contents


Apache Solr is a powerful open-source enterprise search server that is built on top of Apache Lucene. With Apache Solr, users can perform full-text search and hit highlighting; it returns the most accurate search results in the shortest time possible since it helps users to index their data into an optimized format. With SolrCloud, you can easily manage your Solr instances that have been distributed across one or more machines, to provide a highly available and fault-tolerant search solution. In this post, we will look at SolrCloud and Distributed search in Apache Solr, highlighting the benefits, and showing how they can be implemented.

Solr Cloud

SolrCloud is a flexible and highly scalable distributed search and indexing system that is specifically designed to provide fault-tolerant and highly available search solutions, which span multiple servers. With SolrCloud, users can create a large cluster of Solr instances, split their index into shards, and distribute them across different servers. The shards can then be replicated to provide redundancy and ensure that query requests are handled efficiently, even in the case of a server failure. This allows for horizontal scaling, making it possible to handle an increasing amount of data and users.

In a SolrCloud setup, there are two key components: the ZooKeeper ensemble and the Solr instances. ZooKeeper is the centralized configuration management and coordination service. It maintains a hierarchical file system-like structure called the ZNode, which contains information on the Solr indexes and their replicas. ZooKeeper also manages the elections for mastership of the shards and their replicas.

Here’s an example of how to configure a SolrCloud cluster in PHP:

$solrCloudClient = new \SolrClient([
    'hostname' => 'localhost',
    'port' => 8983

$params = new \SolrParams([
    'wt' => 'json',
    'collection' => 'my_collection',

$query = $solrCloudClient->createQuery(\SolrClient::QUERY_SELECT, $params);
$queryResponse = $query->process();

foreach ($queryResponse->getResults() as $doc) {
    echo "{$doc->title} - {$doc->author}n";

Distributed Search

Apache Solr’s Distributed Search is a powerful feature that allows you to search multiple Solr instances simultaneously, as opposed to searching a single index or shard. With Distributed Search, you can combine results from several sources and provide a unified view to the end-user. This feature is useful when you need to query large datasets beyond the capacity of a single server.

Distributed search is also designed to minimize network overhead and latency by using an efficient algorithm that balances query requests across the Solr instances. The algorithm is based on an intelligent system that routes the queries to the Solr instances that hold the required shards, thereby reducing the load on any one instance.

How WPSOLR Can Help

WPSOLR is a powerful WordPress plugin that integrates with Apache Solr to provide an advanced search experience for your website visitors. WPSOLR makes it easy to create, configure, and manage your SolrCloud instances and shards, as well as perform distributed search across multiple servers. With WPSOLR, you can take advantage of Solr’s powerful search features without having to write any complex code. WPSOLR is also highly customizable, and you can customize your search results page easily.


In conclusion, SolrCloud and Distributed Search are powerful tools for anyone looking to build an enterprise-grade search solution. With SolrCloud, you can easily manage your search indexes and provide highly available and fault-tolerant searches. With Distributed Search, you can distribute queries to multiple Solr instances and provide a unified view of the search results. With the help of WPSOLR, you can easily configure and manage your SolrCloud instances and shards, and create custom search queries. So, start building your search solution today with Apache Solr and WPSOLR.

Read more related content

BM25 is no longer a clear winner in 2023?

Very nice paper from Metarank Labs Similar to Vespa papers, Metarank papers are based on hard benchmark figures, which is the best/only way to understand facts.