Tuesday, January 8, 2013

How to configure Apache solr in Java

When we talk about search engine application then solr came in many of us mind.
In many tutorial we find that to use Apache solr we need to configure it inside server like tomcat but what if your tomcat get corrupted
at that time your solr project come in critical suitation.

Today i explain my personal experience of configuring about solr in project itself.

Fist step you need to download latest version of solr click here

NOw extract the download file and move to the following path "apache-solr-latest-version/example/".
there you find "solr" folder copy that folder and paste it in home directory.

Now again move to following folder "apache-solr-latest-version/example/webapps"
extract the solr.war and then move solr/WEB-INF/lib
now copy all jar file this jar file you need to add in your project lib folder

Now create Tomcat project/Dynamice web project as normally you do.

open web.xml file and add the following code


    <env-entry>
       <env-entry-name>solr/home</env-entry-name>
       <env-entry-value>${user.home}/solr</env-entry-value>
       <env-entry-type>java.lang.String</env-entry-type>
    </env-entry>

here we setting the path of solrconfig.xml files which is now inside ur home directory/solr/config we need to specify the path upto solr folder

  <filter>
    <filter-name>SolrRequestFilter</filter-name>
    <filter-class>org.apache.solr.servlet.SolrDispatchFilter</filter-class>
  </filter>

this is the main class which is use to initiate the solr configuration


Your confrigutaion is completed :)

now user home folder/solr/conf you get solrconfig.xml,schema.xml arranged it as per your requirement and start the server

If you really enjoyed this
give feedback
thanks...... :)
 

2 comments:

Unknown said...

Its really nice blog,recently i am studying solr and this blog helped me in configuration...keep on blogging Abhishek

Abhishek Mishra said...

Thanks mars jerk..