Solr Spring Server

A Solr Server Factory for Spring

Лицензия

Лицензия

Группа

Группа

com.indoqa.solr
Идентификатор

Идентификатор

spring-server
Последняя версия

Последняя версия

4.10.0
Дата

Дата

Тип

Тип

jar
Описание

Описание

Solr Spring Server
A Solr Server Factory for Spring
Организация-разработчик

Организация-разработчик

Indoqa Software Design und Beratung GmbH
Система контроля версий

Система контроля версий

https://github.com/Indoqa/solr-spring-server

Скачать spring-server

Как подключить последнюю версию

<!-- https://jarcasting.com/artifacts/com.indoqa.solr/spring-server/ -->
<dependency>
    <groupId>com.indoqa.solr</groupId>
    <artifactId>spring-server</artifactId>
    <version>4.10.0</version>
</dependency>
// https://jarcasting.com/artifacts/com.indoqa.solr/spring-server/
implementation 'com.indoqa.solr:spring-server:4.10.0'
// https://jarcasting.com/artifacts/com.indoqa.solr/spring-server/
implementation ("com.indoqa.solr:spring-server:4.10.0")
'com.indoqa.solr:spring-server:jar:4.10.0'
<dependency org="com.indoqa.solr" name="spring-server" rev="4.10.0">
  <artifact name="spring-server" type="jar" />
</dependency>
@Grapes(
@Grab(group='com.indoqa.solr', module='spring-server', version='4.10.0')
)
libraryDependencies += "com.indoqa.solr" % "spring-server" % "4.10.0"
[com.indoqa.solr/spring-server "4.10.0"]

Зависимости

compile (3)

Идентификатор библиотеки Тип Версия
org.apache.solr : solr-solrj jar 4.10.3
org.apache.solr : solr-core Необязательный jar 4.10.3
org.springframework : spring-beans jar 3.1.1.RELEASE

provided (3)

Идентификатор библиотеки Тип Версия
org.slf4j : slf4j-api jar 1.7.7
org.slf4j : jcl-over-slf4j Необязательный jar 1.7.7
org.slf4j : jul-to-slf4j Необязательный jar 1.7.7

test (1)

Идентификатор библиотеки Тип Версия
junit : junit jar 4.10

Модули Проекта

Данный проект не имеет модулей.

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
    <dependency>
      <groupId>com.indoqa.solr</groupId>
      <artifactId>spring-server</artifactId>
    </dependency>
    
  • Download source
  • run "maven clean install"

Configuration

Initialize the SolrServerFactory for tests with this snippet

    SolrServerFactory 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

    SolrServerFactory solrServerFactory = new SolrServerFactory();
    solrServerFactory.setUrl("http://localhost:8983/test-core");
    solrServerFactory.initialize();

To communicate with a SolrCloud cluster use this snippet

   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

   <bean name="solrServerFactory" class="com.indoqa.solr.server.factory.SolrServerFactory">
     <property name="url" value="file://./target/solr/embedded-test-core" />
     <property name="embeddedSolrConfigurationDir" value="./src/test/resources/solr/test-core" />
   </bean>
com.indoqa.solr

Indoqa

Версии библиотеки

Версия
4.10.0