Monday 27 February 2017

Steps for Solr 6.1 setup with data import handler(DIH)

1. Install Java Runtime Environment (JRE) version 1.8 for Solr 6.1

2. Set Java home "export JAVA_HOME=/usr/lib/jvm/jdk1.8.0_101/"

2. Download solr 6.1 "solr-6.1.0.tgz" from http://www-eu.apache.org/dist/lucene/solr/6.1.0/

3. Extract tgz file using "tar zxf solr-6.1.0.tgz".

4. Open the port 8983 as to communicate with solr.

5. Go to the path ../solr-6.1.0/ and start the server with "bin/solr start"

============================================================================================================================================================

1. Create a config folder named myConfig under configsets directory , move the conf folder into it. Add the data-config.xml into "/myConfig/conf".

2. Fire the url to create the core.

http://localhost:8983/solr/admin/cores?action=CREATE&name=25406&instanceDir=/home/abhijit/Downloads/solr-6.1.0/server/solr/25406/&configSet=myConfig

3. Add the jars "solr-dataimporthandler-6.1.0.jar", "solr-dataimporthandler-extras-6.1.0.jar" to path "/home/abhijit/Downloads/solr-6.1.0/server/lib".

4. Add the "solr-core-6.1.0.jar" jar to the path "/home/abhijit/Downloads/solr-6.1.0/server/lib".

5. Add the "solr-solrj-6.1.0.jar" jar to the path "/home/abhijit/Downloads/solr-6.1.0/server/lib".

6. If you do the above steps you will get the error like :

   "Error Instantiating requestHandler, org.apache.solr.handler.dataimport.DataImportHandler failed to instantiate org.apache.solr.request.SolrRequestHandler"
    This problem occurred because dataimporthandler and requesthandler are loaded by two different class loaders. To solve it, ensure that solr loads its jars only from the same class loader.  

   Option to steps 3,4,5 create a folder lib inside the solr folder at path "/home/abhijit/Downloads/solr-6.1.0/server/solr"
   and add the entry of the same to solrConfig.xml as "<lib dir="./solr/lib" />".
   Comment the other lib entries from solrConfig.xml
   the jars "solr-dataimporthandler-6.1.0.jar", "solr-dataimporthandler-extras-6.1.0.jar" to path "/home/abhijit/Downloads/solr-6.1.0/server/solr/lib".

9. Commented the updateRequestProcessorChain in solrConfig.xml.

10. HttpSolrCall null:org.apache.solr.handler.dataimport.DataImportHandlerException: Data Config problem: Entity must have a name.
    Every entity defined in data-config file must have a name defined to it e.g. "<entity name="tika" , "<entity name="customProperty"

11. Error : "java.lang.NoClassDefFoundError: org/apache/tika/parser/Parser"
    Add the jar "tika-core-1.7.jar" to path "/home/abhijit/Downloads/solr-6.1.0/server/solr/lib".

12. Copy all the jars from "/Downloads/solr-6.1.0/contrib/extraction/lib" to path "/home/abhijit/Downloads/solr-6.1.0/server/solr/lib".

13. Error : " java.sql.SQLSyntaxErrorException: ORA-00907: missing right parenthesis"
    " ' " is missing for the date parameter passed while the full import e.g '24/05/2015'

14. Command for full import

http://localhost:8983/solr/mycore/dataimport?command=full-import&clean=true&commit=true

15. Check core status

http://localhost:8983/solr/admin/cores?action=STATUS&core=25406

16. Delete URL was not working so added the solrConfig.xml file.

  http://10.55.36.19:8983/solr/25406/update?stream.body=<delete><id>25473</id></delete>&commit=true

  <requestHandler name="/update" class="solr.UpdateRequestHandler">
   <lst name="defaults">
      <str name="update.chain">id</str>
   </lst>
  </requestHandler>

   "o.a.s.h.RequestHandlerBase org.apache.solr.common.SolrException: unknown UpdateRequestProcessorChain: add-unknown-fields-to-the-schema"
 
   Uncommentted the "updateRequestProcessorChain" in solrConfig.xml and named it as name="id".

Sunday 26 February 2017

Change in the default port of Jetty for Solr.

Change in the default port of Jetty for Solr.

   Currently Jetty uses 8983 as default port. 

   I wanted to change it to 8080 port.

    To achieve the same I have done the changes at the following places.

     1. Change in the file solr.xml located at ../solr-6.1.0/server/solr/.
        
        Change from  
        
        <int name="hostPort">${jetty.port:8983}</int>
       
        to

        <int name="hostPort">${jetty.port:8080}</int>
      
     

   2. Change in the file solr.in.sh located at ../solr-6.1.0/bin/
        
       Change from 
       
       # Sets the port Solr binds to, default is 8983
        SOLR_PORT=8983

        to 

        # Sets the port Solr binds to, default is 8983
        SOLR_PORT=8080