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

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

I tried searching the Internet for various lessons, but could not find a suitable explanation for the steps.

So my requirements

  • How to integrate apache solr in spring MVC using maven dependency (I use tomcat to host the server)
  • Basic tutorials for adding data files using solr
  • How can I integrate it to collect data from my database. I use hibernate to match the tables of my database.

After a few lessons, I think spring -data-solr is suitable for spring MVC.

PS I am new to all of the above technologies.

+5
source share
1 answer

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

Solr requires a separate installation; it's not just a maven dependency. To install Solr, follow the installation instructions in the manual.

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

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

There is a lot of documentation here on how to use Solr-J. spring-data-solr may also work for you.

Hibernate has nothing to do with integrating solr and spring. Solr can be loaded from your database directly using the data import handler, or you can update documents in solr through your REST API .

+1
source

Source: https://habr.com/ru/post/1207657/


All Articles