Spring Data Solr – Index and Find Documents

In today’s post I would share a sample program to index and find documents into/from Apache Lucene Solr using Spring Data Solr. If you don’t have Solr in your local machine please download and install Solr from official site. This program is tested against the Solr server running in localhost and in default port. (http://localhost:8983/solr/) In this test program we will index two Product objects into Solr preloaded collection named collection1. Please see the schema changes below.

The complete source code for this post can be found in github.

Libraries used

Name Version
SolrJ 4.6.0
Spring Core 4.0.0.RELEASE
Spring Data Solr 1.0.0.RELEASE
JUnit 4.8.1
Spring Test 4.0.0.RELEASE






schema.xml addition

3 thoughts on “Spring Data Solr – Index and Find Documents

Leave a comment

Your email address will not be published. Required fields are marked *