简体   繁体   中英

How to integrate apache solr in spring MVC using maven on tomcat

I am developing a web application using spring MVC and I have hosted this using tomcat . I have a requirement where I want to integrate apache-solr to my search engine.

I tried looking on internet for various tutorials but couldn't find a proper one to explain the steps.

So my requirements are

  1. How to integrate apache solr in spring MVC using maven dependency (I am using tomcat to host the server)
  2. Basic tutorials to add data files with solr
  3. How can I integrate it to pick up the data from my database. I am using hibernate to map my database tables.

After going through some tutorials I think spring-data-solr is suitable for spring MVC.

PS I am new to all the above technologies.

For Solr in general, you should refer to the Solr reference guide for help. It is meant for the upcoming Solr 5.0 release, but most of the guide is still relevant for 4.0 and the other documentation (the old wiki) is of poor quality.

Solr requires a separate installation; it is not just a maven dependency. To install Solr, follow the install instructions from the guide.

To contact solr in your java layer, you can use solr-j , which you can add as a maven dependency, as noted here , the latest version is 4.10.2 :

<dependency> <groupId>org.apache.solr</groupId> <artifactId>solr-solrj</artifactId> <version>4.10.2</version> </dependency>

There's lots of documentation about how to use Solr-J here. spring-data-solr may also work for you.

Hibernate has nothing to do with the integration of solr and spring. Solr can load from your DB directly using the data import handler or you can update documents in solr via its REST API .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM