Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/indoqa/solr-spring-server
A Spring FactoryBean for Solr 4.x servers.
https://github.com/indoqa/solr-spring-server
Last synced: 4 days ago
JSON representation
A Spring FactoryBean for Solr 4.x servers.
- Host: GitHub
- URL: https://github.com/indoqa/solr-spring-server
- Owner: Indoqa
- License: apache-2.0
- Created: 2015-04-02T11:20:10.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2023-10-19T08:57:22.000Z (about 1 year ago)
- Last Synced: 2024-04-09T12:01:40.357Z (7 months ago)
- Language: Java
- Homepage:
- Size: 29.3 KB
- Stars: 2
- Watchers: 9
- Forks: 0
- Open Issues: 4
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Indoqa Solr Spring Server
This project offers a Spring based implementation of a FactoryBean for communicating with Apache Solr servers.
The SolrServerFactory allows to communicate with Solr either embedded, via http or Apache ZooKeeper for SolrCloud installations.
The desired behavior is configured with the supplied url:
* file:// - uses the EmbeddedSolrServer
* http:// - uses the HttpSolrServer
* cloud:// - uses the CloudSolrServer## Installation
### Requirements
* Apache Solr 4.10+
* Spring Beans 3.1+
* Java 6+
### Build* Download the latest release via maven
```xml
com.indoqa.solr
spring-server
```* Download source
* run "maven clean install"
## Configuration### Initialize the SolrServerFactory for tests with this snippet
```javaSolrServerFactory solrServerFactory = new SolrServerFactory();
solrServerFactory.setUrl("file:///tmp/solr-spring-server/embedded-test-core");
solrServerFactory.setEmbeddedSolrConfigurationDir("./src/test/resources/solr/test-core");
solrServerFactory.initialize();SolrServer solrServer = solrServerFactory.getObject();
QueryResponse response = solrServer.query(new SolrQuery("*:*"));
...
solrServer.shutdown();
solrServerFactory.destroy();```
The url can either be a relative or absolute directory, the embeddedSolrConfigurationDir must include the usual Solr configuration files:* schema.xml
* solrconfig.xml### To communicate with a single Solr server use this snippet
```java
SolrServerFactory solrServerFactory = new SolrServerFactory();
solrServerFactory.setUrl("http://localhost:8983/test-core");
solrServerFactory.initialize();
```### To communicate with a SolrCloud cluster use this snippet
```java
SolrServerFactory solrServerFactory = new SolrServerFactory();
solrServerFactory.setUrl("cloud://zkHost1:2181,zkHost2:2182?collection=test-collection");
solrServerFactory.initialize();```
The syntax uses zkHost1:2181,zkHost2:2182 for the ZooKeeper instances in your ZooKeeper ensemble, followed by the collection to be used.
This ensures that the communication for update requests will be established against the leader of the collection to minimize communication overhead.### Solr Spring server integration based on xml configuration
```xml
```