What is Apache Solr?

Apache Solr is an open-source, high-performance search platform built on top of the Apache Lucene library. It is designed to provide full-text search, faceted navigation, filtering, distributed indexing, and real-time search capabilities for large-scale data applications.

Solr is widely used in enterprise environments, especially in applications requiring fast and scalable search functionalities such as e-commerce platforms, content management systems (CMS), big data systems, and intranet search engines.


Key Features of Apache Solr

Full-Text Search

  • Powerful text analysis, including stemming, stop words, synonyms, and tokenization.
  • Supports wildcards, fuzzy matching, phrase search, and Boolean operators.
  • Language detection and multi-language support.

Advanced Query Capabilities

  • Rich query syntax with filter queries (fq) and boosting.
  • Geospatial search (lat/long-based queries).
  • Range queries, joins, grouping, and faceting.

Faceted Search and Filtering

  • Create dynamic navigation menus and drill-down interfaces.
  • Supports field-based, range-based, and query-based facets.
  • Ideal for e-commerce and product catalog filtering.

Indexing and Data Ingestion

  • Supports multiple data sources: XML, JSON, CSV, and database connectors via DataImportHandler.
  • Real-time indexing capabilities.
  • Document versioning and atomic updates.

Scalability and Clustering

  • Built-in support for horizontal scaling using SolrCloud.
  • Distributed indexing and searching across multiple nodes.
  • ZooKeeper integration for cluster coordination.

Analytics and Highlighting

  • Built-in analytics for aggregation and statistical functions.
  • Highlight matched terms in search results.
  • Spell checking, autocomplete/suggestions, and result ranking.

Security and Monitoring

  • Basic authentication, role-based access, and SSL/TLS support.
  • RESTful APIs for managing collections, schema, config, and more.
  • Integration with logging and monitoring tools (Prometheus, Grafana, etc.).

Apache Solr vs Other Search Platforms

FeatureSolrElasticsearchSphinxWhoosh
Built on Lucene✅ Yes✅ Yes❌ No❌ No
REST API✅ Yes✅ Yes✅ Yes✅ Limited
Faceted Search✅ Yes✅ Yes⚠️ Limited❌ No
Distributed Search✅ Yes (SolrCloud)✅ Yes⚠️ Limited❌ No
Full-Text Search✅ Yes✅ Yes✅ Yes✅ Yes
Autocomplete & Suggestions✅ Yes✅ Yes❌ No❌ No
Real-Time Indexing✅ Yes✅ Yes❌ No❌ No
Ease of Setup⚠️ Moderate✅ Easy✅ Easy✅ Easy
Best Use CaseEnterprise, CMS, EcommerceLogging, Analytics, Real-time DataLightweight appsSmall Python apps

Common Use Cases

✅ E-commerce Platforms – Product search with filtering, autosuggest, and ranking.
✅ Enterprise Search – Indexing internal documents and knowledge bases.
✅ CMS and News Portals – Indexing articles, blogs, and multimedia content.
✅ Big Data Analytics – Paired with Hadoop, Spark, or Kafka for searching large datasets.
✅ APIs and Web Applications – Fast backend search functionality for web and mobile apps.


Pros of Apache Solr

  • Mature and highly reliable for production use.
  • Feature-rich with excellent support for structured and unstructured data.
  • Strong community and enterprise adoption.
  • Integrates easily with other Apache tools (Tika, Nutch, Hadoop, etc.).
  • Powerful schema and configuration management.

Cons

  • More complex to set up and manage compared to Elasticsearch.
  • Requires manual tuning for optimal performance in large-scale deployments.
  • UI (Solr Admin) is functional but not as modern as Kibana (Elasticsearch’s UI).
  • Schema changes may require restarts or re-indexing, depending on use case.

Apache Solr is a robust and versatile search engine suitable for any application that requires advanced search capabilities, especially in enterprise and large data environments. It combines the raw power of Apache Lucene with a flexible and extensible architecture, making it ideal for e-commerce, content search, business analytics, and internal document indexing—particularly for users on Debian 12 or similar Linux environments.

If you need reliable, high-speed, full-text search with extensive configuration control and scalability, Solr is one of the best options available.


Step 1: Set Up a Server Instance

To begin with, you’ll need a server where you can install Apache Solr. Shape.Host offers a simple, intuitive interface for creating cloud-based VPS instances.

Log in to your Shape.Host dashboard at https://shape.host.

Click “Create”.

Choose Instance as your server type.

Shape.host Resources dashboard with Create > Instance highlighted.

Select a data center location near your users for optimal latency.

Shape.host instance form with the data center location selector highlighted.

Pick a hosting plan with at least 2 vCPUs, 4 GB RAM, and 20 GB storage for Solr.

In the Operating System section, select Ubuntu 24.04 (64-bit).

Shape.host instance form with the operating system image selector highlighted.

Finalize by clicking “Create Instance”. Your instance will be ready within moments.

Shape.host instance form with the Create Instance button highlighted.

Once the instance is created, go to the Resources section to find the public IP address of your instance. You will use this to connect to the instance remotely.

Shape.host Resources dashboard with the server IP address highlighted.

Shape.Host’s infrastructure is optimized for performance and security, making it ideal for hosting applications like Solr.


Step 2: Connect to Your Instance

Once your server is live, connect to it via SSH.

For Linux/macOS:

ssh root@your_server_ip

For Windows:

Use PuTTY or [Windows Terminal] and connect using:

  • Host Name (IP address): your_server_ip
  • Port: 22
  • Connection type: SSH
  • Log in with the credentials received from Shape.Host.

Step 3: Install Apache Solr

Now let’s go through the step-by-step commands used to install Apache Solr, along with system configuration tweaks.

3.1. Adjust Kernel Parameters (for large memory allocation)

echo 4294967295 > /proc/sys/kernel/shmmax
echo 1536 > /proc/sys/vm/nr_hugepages

3.2. Set security limits (optional tuning)

Edit the file:

nano /etc/security/limits.conf
Terminal showing echo commands or output during Set security limits (optional tuning).

Increase the max open files and processes for user root (your user) with the following configuration.

solr soft nofile 65000
solr hard nofile 65000
solr soft nproc 65000
solr hard nproc 65000
Terminal editing file and process resource limits for Solr.

3.3. Update the system

apt update
Terminal showing APT package management commands and output.

3.4. Install Java Development Kit (required for Solr)

apt install default-jdk
Terminal showing APT package management commands and output.

3.5. Verify Java installation

java --version
Terminal showing java commands or output during Verify Java installation.

3.6. Install additional tools

apt install curl lsof bc
Terminal showing APT package management commands and output.

3.7. Download Solr 9.7.0

wget https://www.apache.org/dyn/closer.lua/solr/solr/9.7.0/solr-9.7.0.tgz?action=download
Terminal showing file download commands and transfer output.

3.8. Rename the downloaded file

mv 'solr-9.7.0.tgz?action=download' solr-9.7.0.tgz

3.9. Extract the installation script

tar xzf solr-9.7.0.tgz solr-9.7.0/bin/install_solr_service.sh --strip-components=2

3.10. Install Solr as a service

bash ./install_solr_service.sh solr-9.7.0.tgz
Terminal showing a systemd service unit configuration.

3.11. Check if Solr is listening on its port

ss -tulpn
Terminal showing ss commands or output during Check if Solr is listening on its port.

Step 4: Configure Apache Solr

4.1. Edit Solr environment configuration

nano /etc/default/solr.in.sh

Update the following variables (replace with your server’s IP):

SOLR_HEAP="4g"
SOLR_HOST="51.89.69.203"
SOLR_JETTY_HOST="51.89.69.203"

4.2. Restart Solr

systemctl restart solr

4.3. Check if Solr is running

ss -tulpn
Terminal showing systemd service management commands or output.

Step 5: Enable Authentication and Create User

5.1. Create the security.json configuration

nano /var/solr/data/security.json

Paste the following content:

{
 "authentication":{
   "blockUnknown": true,
   "class":"solr.BasicAuthPlugin",
   "credentials":{
     "solr":"IV0EHq1OnNrj6gvRCwvFwTrZ1+z1oBbnQdiVC3otuq0= Ndd7LKvVBAaZIF0QAVi1ekCfAJXr1GGfLtRUXhgrF8c="
   },
   "realm":"My Solr users",
   "forwardCredentials": false
 },
 "authorization":{
   "class":"solr.RuleBasedAuthorizationPlugin",
   "permissions":[{"name":"all", "role":"admin"}],
   "user-role":{"solr":"admin"}
 }
}
Terminal showing the GNU nano editor and configuration text.

5.2. Restart Solr to apply authentication

systemctl restart solr

5.3. Enable basic auth in Solr configuration

nano /etc/default/solr.in.sh

Uncomment the following lines:

SOLR_AUTH_TYPE="basic"
SOLR_AUTHENTICATION_OPTS="-Dbasicauth=solr:SolrRocks"

5.4. Restart Solr again

systemctl restart solr

Step 6: Create Your First Collection

Let’s create a sample index to verify everything is working:

su - solr -c "/opt/solr/bin/solr create -c my_first_index -n MyIndex"
Terminal showing systemd service management commands or output.

You can now access Solr’s web UI at:

http://your_server_ip:8983

Use the username solr and password SolrRocks to log in.

Solr authentication required message.
Apache Solr administration overview with system information and JVM settings.

For developers, businesses, and enterprises seeking high-performance search functionality, Apache Solr delivers the flexibility and power needed to handle demanding workloads.

Try Shape.Host Cloud VPS today for fast provisioning, full root access, and optimized environments tailored for services like Solr.