DBDB.io The Encyclopedia of Database Systems · Est. 2017
Database of Databases

Database Entry

Solr


Solr is an open source NoSQL enterprise search platform built on Apache Lucene. Supporting distributed search and index replication, Solr is highly reliable, scalable and fault tolerant. It runs as a standalone full-text search server with a REST-like API and provides features including hit highlighting, faceted search, near real-time indexing, dynamic clustering, database integration, and geospatial search. Currently, Solr powers some of the highest-traffic websites and applications in the world.[01]

Source Code
https://github.com/apache/solr[02]
Country of Origin
US
Start Year
2004 [05]
Coding Agents
Project Type
Open Source
Written in
Java
Supported Languages
C#, C++, Clojure, Go, Java, JavaScript, Lua, Perl, PHP, Python, R, Ruby, Rust, Scala
Embeds / Uses
Lucene
Operating Systems
Linux, macOS, Windows
License
Apache v2

Database Entry

Solr


Solr is an open source NoSQL enterprise search platform built on Apache Lucene. Supporting distributed search and index replication, Solr is highly reliable, scalable and fault tolerant. It runs as a standalone full-text search server with a REST-like API and provides features including hit highlighting, faceted search, near real-time indexing, dynamic clustering, database integration, and geospatial search. Currently, Solr powers some of the highest-traffic websites and applications in the world.[01]

History[05]


In 2004, CNET Networks, an American media website, started Solr to support search capability and later donated to Apache Software Foundation as a open-source project in 2006. In 2007, graduated as a top-level project (TLP), Solr grew steadily with more features and supported several popular websites. Finally in 2010, Solr was merged with Lucene as a sub project and changed the version number to 3.1 after Solr 1.4 to match that of Lucene.

Checkpoints[06][07][08]


For standalone mode, Solr provides support for checkpoints through replication handler and will back up the system from the latest index commit point. Checkpoints can be triggered manually or users can set customized configurations to back up automatically after each commit or startup. For SolrCloud mode, Solr utilizes the Collection API which will back up the indexes and configurations to a shared filesystem. The checkpoints will be taken across multiple shards. When restoring, a new collection with same number of shards will be created and will preserve all the shard structure like routing information.

Concurrency Control[09]


Solr uses Optimistic Concurrency Control to ensure that documents can not be concurrently modified by multiple client applications. All documents will be assigned a version field. When updating, clients are guaranteed to read the latest version and resubmit the document after local modification. When a version conflict is encountered, the transaction should be redone.

Data Model[10][11]


Solr stores data as documents which consist of different fields. Each field contains a piece of more specific information about the document and can have different data types. Using the index of documents, Solr can provide efficient search.

Foreign Keys[12][13]


Solr supports foreign keys to indicate relationships between documents as "join", which is different from that of relational database. Join in Solr will not truly join the documents and only generate information from one document, which is more similar to nested query. There is no support for foreign key constraints in Solr. Programmer needs to specify the from and to fields to explicitly join two documents with the join QueryParser.

Indexes[14][15][16]


Solr adopts the inverted index which lists the terms of all documents, each with a list of documents it appears in and the number of occurrence. The inverted index allows faster query processing. Solr also supports DocValue which is a column-oriented field mapping documents to values to support features like sorting and faceting.

Isolation Levels[17][18][19]


In Solr, updates is not visible to searchers until it has been committed to the index. The default action for commit is a "hard commit" which writes all the affected index segments to disk. Solr also supports "soft commit" which only commits the changes to the Lucene data structures to realize Near Real Time (NRT) search. In NRT, documents are available for search soon after being indexed without the need to wait for various background tasks to finish.

Joins[20][21][22][23]


Solr supports joins (that of typical relational database systems) through Streaming Expressions which is designed to perform parallel computing tasks in SolrCloud. In Solr, Streaming Decorator expressions provide two types of joins by wrapping two streams: hash join / outer hash join and left outer join / inner join which is implemented using the idea of Sort-Merge Join.

Logging[18][24][25]


On each update, Solr writes the entire documents as transaction logs (tlog) to disk in order to achieve reliability and consistency. When doing soft commits, Solr only changes the Lucene data structures and write the tlogs. When doing hard commits, Solr will truncate the tlogs and create a new one since all the previously affected index segments have been written to the disk. When doing the recovery, Solr follows the tlogs to redo updates that have not been fsync’d (hard committed).

Query Compilation[26]


Query Execution[27]


Solr processes queries by examining each document a time. By computing a score for each document, Solr generates a ranking and returns results based on that.

Query Interface[28][29]


In Solr, the REST interfaces provide easy integrating with many languages. Customers can initiate HTTP requests to send command to Solr and receive responses through Client APIs. These custom APIs handle the work of sending requests and parsing responses.

Storage Architecture[30][31]


Solr stores its index files on disk. Uncommitted updates will be kept in memory as a small buffer.

Storage Model[32]


Solr stores data in inverted index which stores the documents containing the same term contiguously in a block of data. This is an efficient storage model for OLAP workloads since search can be processed quickly by scanning over some terms.

Stored Procedures[33]


It's not supported in Solr currently. But people have proposed different approaches to handle that.

System Architecture[34]


Solr can split an index across multiple shards to distribute data and forms the shared-nothing system architecture. Each shard is a partition of the collection, containing a subset of the documents. Each document will be stored in exactly one shard. SolrCloud also supports automatic distribution for both documents and queries, and ZooKeeper provides load balancing.

Views


Compatible Systems
GraphDB GraphDB
Derivative Systems
Chronix Chronix
Embeddings
CL CloudSearch

Citations

36 sources
  1. Welcome to Apache Solr - Apache Solr apache.org
  2. GitHub - apache/solr: Apache Solr open-source search software · GitHub github.com
  3. Resources - Apache Solr apache.org
  4. Apache Solr - Wikipedia wikipedia.org
  5. Apache Solr - Wikipedia wikipedia.org
  6. Making and Restoring Backups | Apache Solr Reference Guide 7.3 apache.org
  7. Index Replication | Apache Solr Reference Guide 7.3 apache.org
  8. Collections API | Apache Solr Reference Guide 7.3 apache.org
  9. Updating Parts of Documents | Apache Solr Reference Guide 7.3 apache.org
  10. http://www.solrtutorial.com/basic-solr-concepts.html solrtutorial.com Dead — Check Archive
  11. Overview of Documents, Fields, and Schema Design | Apache Solr Reference Guide 7.3 apache.org
  12. https://wiki.apache.org/solr/Join apache.org Dead — Check Archive
  13. Other Parsers | Apache Solr Reference Guide 7.3 apache.org
  14. org.apache.lucene.codecs.lucene70 (Lucene 7.3.0 API) apache.org
  15. Solr Glossary | Apache Solr Reference Guide 7.3 apache.org
  16. DocValues | Apache Solr Reference Guide 7.3 apache.org
  17. Near Real Time Searching | Apache Solr Reference Guide 7.2 apache.org
  18. https://lucidworks.com/2013/08/23/understanding-transaction-logs-softcommit-and-commit-in-sorlcloud lucidworks.com Dead — Check Archive
  19. UpdateHandlers in SolrConfig | Apache Solr Reference Guide 7.3 apache.org
  20. Stream Decorator Reference | Apache Solr Reference Guide 7.3 apache.org
  21. Stream Decorator Reference | Apache Solr Reference Guide 7.3 apache.org
  22. Stream Decorator Reference | Apache Solr Reference Guide 7.3 apache.org
  23. Stream Decorator Reference | Apache Solr Reference Guide 7.3 apache.org
  24. UpdateHandlers in SolrConfig | Apache Solr Reference Guide 6.6 apache.org
  25. Read and Write Side Fault Tolerance | Apache Solr Reference Guide 6.6 apache.org
  26. Query Syntax and Parsing | Apache Solr Reference Guide 7.3 apache.org
  27. org.apache.lucene.search (Lucene 4.6.0 API) apache.org
  28. https://wiki.apache.org/solr/IntegratingSolr apache.org Dead — Check Archive
  29. Introduction to Client APIs | Apache Solr Reference Guide 7.3 apache.org
  30. DataDir and DirectoryFactory in SolrConfig | Apache Solr Reference Guide 6.6 apache.org
  31. https://wiki.apache.org/solr/SolrPerformanceProblems apache.org Dead — Check Archive
  32. Solr Glossary | Apache Solr Reference Guide 6.6 apache.org
  33. https://sematext.com/blog/parametrizing-queries-in-solr-and-elasticsearch sematext.com Dead — Check Archive
  34. Shards and Indexing Data in SolrCloud | Apache Solr Reference Guide 6.6 apache.org
  35. https://github.com/apache/solr/commit/8c49326e71b2c18388b25c8c77ff3fbdda666be8 github.com
  36. https://github.com/apache/solr/commit/8938b9d257774533aaaf9e0803573fa726962243 github.com
Revision #17 Last Updated: