Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
59 changes: 9 additions & 50 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

<groupId>org.springframework.data</groupId>
<artifactId>spring-data-solr</artifactId>
<version>3.1.0.BUILD-SNAPSHOT</version>
<version>2.1.8.RELEASE</version>

<name>Spring Data Solr</name>
<description>Spring Data module providing support for Apache Solr repositories.</description>
Expand All @@ -14,16 +14,16 @@
<parent>
<groupId>org.springframework.data.build</groupId>
<artifactId>spring-data-parent</artifactId>
<version>2.1.0.BUILD-SNAPSHOT</version>
<version>1.9.8.RELEASE</version>
</parent>

<properties>
<dist.key>DATASOLR</dist.key>
<commons.collections>3.2.1</commons.collections>
<commons.lang>3.1</commons.lang>
<httpcomponents>4.3.1</httpcomponents>
<solr>6.6.1</solr>
<springdata.commons>2.1.0.BUILD-SNAPSHOT</springdata.commons>
<java-module-name>spring.data.solr</java-module-name>
<solr>5.5.0</solr>
<springdata.commons>1.13.8.RELEASE</springdata.commons>
</properties>

<developers>
Expand Down Expand Up @@ -141,28 +141,9 @@
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.apache.solr</groupId>
<artifactId>solr-langid</artifactId>
<version>${solr}</version>
<scope>test</scope>
</dependency>


<!-- CDI -->
<!-- Dependency order required to build against CDI 1.0 and test with CDI 2.0 -->
<dependency>
<groupId>org.apache.geronimo.specs</groupId>
<artifactId>geronimo-jcdi_2.0_spec</artifactId>
<version>1.0.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>javax.interceptor</groupId>
<artifactId>javax.interceptor-api</artifactId>
<version>1.2.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>javax.enterprise</groupId>
<artifactId>cdi-api</artifactId>
Expand All @@ -171,14 +152,8 @@
<optional>true</optional>
</dependency>
<dependency>
<groupId>javax.annotation</groupId>
<artifactId>javax.annotation-api</artifactId>
<version>${javax-annotation-api}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.openwebbeans</groupId>
<artifactId>openwebbeans-se</artifactId>
<groupId>org.apache.openwebbeans.test</groupId>
<artifactId>cditest-owb</artifactId>
<version>${webbeans}</version>
<scope>test</scope>
</dependency>
Expand Down Expand Up @@ -281,22 +256,6 @@
</plugins>
</build>
</profile>
<profile>
<id>solr-next</id>
<repositories>
<repository>
<id>apache.snapshots</id>
<name>Apache Snapshot Repository</name>
<url>http://repository.apache.org/snapshots</url>
<releases>
<enabled>false</enabled>
</releases>
</repository>
</repositories>
<properties>
<solr>6.7.0-SNAPSHOT</solr>
</properties>
</profile>
</profiles>

<issueManagement>
Expand All @@ -317,8 +276,8 @@

<repositories>
<repository>
<id>spring-libs-snapshot</id>
<url>https://repo.spring.io/libs-snapshot</url>
<id>spring-libs-release</id>
<url>https://repo.spring.io/libs-release</url>
</repository>
</repositories>

Expand Down
6 changes: 3 additions & 3 deletions src/main/asciidoc/preface.adoc
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
= Preface

The Spring Data for Apache Solr project applies core Spring concepts to the development of solutions using the Apache Solr Search Engine. We provide a "template" as a high-level abstraction for storing and querying documents. You will notice similarities to the mongodb support in the Spring Framework.
The Spring Data Solr project applies core Spring concepts to the development of solutions using the Apache Solr Search Engine. We provide a "template" as a high-level abstraction for storing and querying documents. You will notice similarities to the mongodb support in the Spring Framework.

[[project]]
[preface]
Expand All @@ -16,13 +16,13 @@ The Spring Data for Apache Solr project applies core Spring concepts to the deve
[preface]
== Requirements

Requires Java 8 runtime and http://lucene.apache.org/solr/[Apache Solr] 6.6. Preferably the latest 6.6.x version.
Requires http://lucene.apache.org/solr/[Apache Solr] 5. Preferably the latest 5.x version.

[source,xml]
----
<dependency>
<groupId>org.apache.solr</groupId>
<artifactId>solr-solrj</artifactId>
<artifactId>solr-core</artifactId>
<version>${solr.version}</version>
</dependency>
----
77 changes: 52 additions & 25 deletions src/main/asciidoc/reference/data-solr.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ Using the `repositories` element looks up Spring Data repositories as described
----
====

Using the `solr-server` or `embedded-solr-server` element registers an instance of `SolrClient` in the context.
Using the `solr-server` or `embedded-solr-server` element registers an instance of `SolrClient` in the context.

.HttpSolrClient using Namespace
====
Expand All @@ -47,7 +47,7 @@ Using the `solr-server` or `embedded-solr-server` element registers an instance
http://www.springframework.org/schema/data/solr/spring-solr.xsd">

<solr:solr-client id="solrClient" url="http://locahost:8983/solr" />
</beans>
</beans>
----
====

Expand All @@ -65,7 +65,7 @@ Using the `solr-server` or `embedded-solr-server` element registers an instance
http://www.springframework.org/schema/data/solr/spring-solr.xsd">

<solr:solr-client id="solrClient" url="http://locahost:8983/solr,http://localhost:8984/solr" />
</beans>
</beans>
----
====

Expand All @@ -83,7 +83,7 @@ Using the `solr-server` or `embedded-solr-server` element registers an instance
http://www.springframework.org/schema/data/solr/spring-solr.xsd">

<solr:embedded-solr-server id="solrClient" solrHome="classpath:com/acme/solr" />
</beans>
</beans>
----
====

Expand All @@ -99,13 +99,13 @@ The Spring Data Solr repositories support cannot only be activated through an XM
@Configuration
@EnableSolrRepositories
class ApplicationConfig {

@Bean
public SolrClient solrClient() {
EmbeddedSolrServerFactory factory = new EmbeddedSolrServerFactory("classpath:com/acme/solr");
return factory.getSolrServer();
}

@Bean
public SolrOperations solrTemplate() {
return new SolrTemplate(solrClient());
Expand All @@ -116,6 +116,33 @@ class ApplicationConfig {

The configuration above sets up an `EmbeddedSolrServer` which is used by the `SolrTemplate` . Spring Data Solr Repositories are activated using the `@EnableSolrRepositories` annotation, which essentially carries the same attributes as the XML namespace does. If no base package is configured, it will use the one the configuration class resides in.

[[solr.multicore]]
=== Multicore Support

Solr handles different collections within one core. Use `MulticoreSolrClientFactory` to create separate `SolrClient` for each core.

.Multicore Configuration
====
[source,java]
----
@Configuration
@EnableSolrRepositories(multicoreSupport = true)
class ApplicationConfig {

private static final String PROPERTY_NAME_SOLR_SERVER_URL = "solr.host";

@Resource
private Environment environment;

@Bean
public SolrClient solrClient() {
return new HttpSolrClient(environment.getRequiredProperty(PROPERTY_NAME_SOLR_SERVER_URL));
}

}
----
====

[[solr.cdi]]
=== Solr Repositores using CDI

Expand Down Expand Up @@ -182,7 +209,7 @@ Deriving the query from the method name is not always sufficient and/or may resu
[[solr.query-methods.criterions]]
=== Query creation

Generally the query creation mechanism for Solr works as described in <<repositories.query-methods>> . Here's a short example of what a Solr query method translates into:
Generally the query creation mechanism for Solr works as described in <<repositories.query-methods>> . Here's a short example of what a Solr query method translates into:

.Query creation from method names
====
Expand All @@ -201,7 +228,7 @@ The method name above will be translated into the following solr query
q=name:?0 AND popularity:?1
----

A list of supported keywords for Solr is shown below.
A list of supported keywords for Solr is shown below.

[cols="1,2,3", options="header"]
.Supported keywords inside method names
Expand Down Expand Up @@ -362,12 +389,12 @@ Product.findByName=name:?0
[source,java]
----
public interface ProductRepository extends SolrCrudRepository<Product, String> {

List<Product> findByNamedQuery(Integer popularity);

@Query(name = "Product.findByName")
List<Product> findByAnnotatedNamedQuery(String name);

List<Product> findByAnnotatedNamedQuery(String name);
}
----

Expand All @@ -388,32 +415,32 @@ Though there is already support for Entity Mapping within SolrJ, Spring Data Sol
public class Product {
@Field
private String simpleProperty;

@Field("somePropertyName")
private String namedPropery;

@Field
private List<String> listOfValues;

@Indexed(readonly = true)
@Field("property_*")
private List<String> ignoredFromWriting;

@Field("mappedField_*")
private Map<String, List<String>> mappedFieldValues;

private Map<String, List<String>> mappedFieldValues;
@Dynamic
@Field("dynamicMappedField_*")
private Map<String, String> dynamicMappedFieldValues;

private Map<String, String> dynamicMappedFieldValues;
@Field
private GeoLocation location;

}
----
====

Taking a look as the above `MappingSolrConverter` will do as follows:
Taking a look as the above `MappingSolrConverter` will do as follows:

[cols="1,3", options="header"]
|===
Expand All @@ -440,7 +467,7 @@ Taking a look as the above `MappingSolrConverter` will do as follows:
| `<field name="location">48.362893,14.534437</field>`
|===

To register a custom converter one must add `CustomConversions` to `SolrTemplate` initializing it with own `Converter` implementation.
To register a custom converter one must add `CustomConversions` to `SolrTemplate` initializing it with own `Converter` implementation.

====
[source]
Expand All @@ -450,9 +477,9 @@ To register a custom converter one must add `CustomConversions` to `SolrTemplate
<bean class="org.springframework.data.solr.core.mapping.SimpleSolrMappingContext" />
</constructor-arg>
<property name="customConversions" ref="customConversions" />
</bean>
</bean>

<bean id="customConversions" class="org.springframework.data.solr.core.convert.SolrCustomConversions">
<bean id="customConversions" class="org.springframework.data.solr.core.convert.CustomConversions">
<constructor-arg>
<list>
<bean class="com.acme.MyBeanToSolrInputDocumentConverter" />
Expand Down
Loading