Basic configurations of Solr index Oracle Database

Source: Internet
Author: User

1: Add the following configuration to tomcat_home/solr/config/solrconfig. xml:

<RequestHandler name = "/dataimport" class = "org. apache. solr. handler. dataimport. DataImportHandler">
<Lst name = "defaults">
<Str name = "config"> data-config.xml </str>
</Lst>
</RequestHandler>

 

 

2: Create the data-config.xml file in tomcat_home/solr/config/(in the same directory as solrconfig. xml), add the following content

<DataConfig>
<DataSource type = "JdbcDataSource" driver = "Oracle. jdbc. driver. oracleDriver "url =" jdbc: oracle: thin: @ // 192.98.12.216: 1521/db11g "user =" test1 "password =" test1 "/>
<Document>
<Entity name = "id" query = "select OBJECTID, F_PRODUCTNAME, F_DATAFORMATDES from cj_billion">
<Field column = "OBJECTID" name = "id"/>
<Field column = "F_PRODUCTNAME" name = "geo_name"/>
<Field column = "F_DATAFORMATDES" name = "geo_summary"/>
</Entity>
</Document>
</DataConfig>

 

 

3: Add the following fields to the tomcat_home/solr/conf/schema. xml file:

<Field name = "geo_name" type = "text_general" indexed = "true" stored = "true"/>
<Field name = "geo_summary" type = "text_general" indexed = "true" stored = "true"/>

 

 

4: place the oracle jdbc driver in tomcat_home/webapps/solr/WEB_INF/lib.

 


5: copy the apache-solr-dataimporthandler-3.6.1.jar and apache-solr-dataimporthandler-extras-3.6.1.jar in the solr_home/dist/folder to the tomcat_home/solr/lib/folder

 

 

6: start tomcat and access http: // localhost: 8081/solr/dataimport? Command = full-import all data to the solr server for Indexing

‍Http: // localhost: 8081/solr/dataimport? Command = delta-import incremental import data

Http: // localhost: 8081/solr/dataimport? Command = status to view the running status

Http: // localhost: 8081/solr/dataimport? Command = reload-config can reload the configuration file

Terminate http: // localhost: 8080/solr/dataimport? Command = abort

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.