Apache Solr
This is the implementation of the Solr data handler for MindsDB.
Apache Solr is a highly reliable, scalable and fault tolerant, providing distributed indexing, replication and load-balanced querying, automated failover and recovery, centralized configuration, and more.
Prerequisites
Before proceeding, ensure the following prerequisites are met:
- Install MindsDB locally via Docker or Docker Desktop.
- To connect Apache Solr to MindsDB, install the required dependencies following this instruction.
- Install or ensure access to Apache Solr.
Implementation
This handler is implemented using the sqlalchemy-solr
library, which provides a Python/SQLAlchemy interface.
The required arguments to establish a connection are as follows:
username
is the username used to authenticate with the Solr server. This parameter is optional.password
is the password to authenticate the user with the Solr server. This parameter is optional.host
is the host name or IP address of the Solr server.port
is the port number of the Solr server.server_path
defaults tosolr
if not provided.collection
is the Solr Collection name.use_ssl
defaults tofalse
if not provided.
Further reference: https://pypi.org/project/sqlalchemy-solr/.
Usage
In order to make use of this handler and connect to the Solr database in MindsDB, the following syntax can be used:
You can use this established connection to query your table as follows:
Requirements
A Solr instance with a Parallel SQL supported up and running.
There are certain limitations that need to be taken into account when issuing queries to Solr. Refer to https://solr.apache.org/guide/solr/latest/query-guide/sql-query.html#parallel-sql-queries.
Don’t forget to put limit in the end of the SQL statement
Was this page helpful?