Integrates Apache Solr into Quarkus for JDK and native builds.
- Solr as a dev-service for local development
- Provide SolrJ beans for interacting with Solr
- Native compilation support
- Integration with Quarkus observability stack (health, metrics, logging)
Add the following dependency to your project:
<dependency>
<groupId>io.quarkiverse.solr</groupId>
<artifactId>quarkus-solr</artifactId>
<version>${latest.version}</version>
</dependency>Then you can use SolrJ beans in your application to interact with Solr. For example:
import org.apache.solr.client.solrj.SolrClient;
@ApplicationScoped
public class SolrService {
@Inject
SolrClient solrClient;
public SolrDocumentList query(String query) throws SolrServerException, IOException {
SolrQuery solrQuery = new SolrQuery();
solrQuery.setQuery(query);
return solrClient.query("collectionName", solrQuery).getResults();
}
}For dev-mode, a Solr instance will be automatically started and configured with a default collection called dummy. For non-dev-mode, you have to configure the Solr client using the following property:
quarkus.solr.url=http://localhost:8983/solrCheck the documentation for detailed information and usage guidelines.
Quarkus Solr has only been tested with Solr 10.0.0 and Quarkus 3.34.0, but other versions of Solr and Quarkus should work as well. If you encounter any issues, please report them in the issue tracker.
Feel free to contribute to this project by submitting issues or pull requests.
Changelog is available in GitHub
This project is licensed under the Apache License 2.0 - see the LICENSE file for details.