Import Oracle Data Using Solr5.3.0

Source: Internet
Author: User
Tags solr

Import Oracle Data Using Solr5.3.0

1. Modify solr-data-config. Xml file with the following content: (PS: This article creates an index based on the siteinfo table of the yqfx database in the Oracle database. The site table contains three fields: id, name, and url, all are varchar type, schema. for the xml file, the type must be string type)

<DataConfig>
<DataSource password = "scott" user = "scott" url = "jdbc: oracle: thin :@192.168.0.41: 1521: yqfx" driver = "oracle. jdbc. driver. oracleDriver "/>
<Document name = "Info" pk = "id">
<Entity name = "zpxx" transformer = "ClobTransformer" pk = "id"
Query = "SELECT * FROM siteinfo"
DeltaImportQuery = "SELECT id, url FROM siteinfo where id = '$ {dih. delta. id }'"
DeltaQuery = "select id from siteinfo where createTime> '$ {dataimporter. last_index_time}'">
<Field name = "id" column = "id"/>
<Field name = "url" column = "url"/>
<Filed name = "createTime" coiumn = "createTime"/>
</Entity>
</Document>
</DataConfig>

Where:

Query is an SQL statement that obtains all data (solr obtains the data from the SQL statement) and multiple columns.

DeltaImportQuery is an SQL statement used to obtain incremental data (data added to solr by the database), with multiple columns

DeltaQuery is the SQL statement used to obtain the primary key (new data in the database is the condition when the data is appended to solr. Based on the id, the condition is the last time the data is obtained, $ {dataimporter. last_index_time, last retrieved time}), one column

2. Modify the schema. xml file to declare the field. The field name should be the same as the column name of the SQL query result set;

<-- Zx configures the field of the SSH Library -->
<Field name = "id" type = "int" indexed = "true" stored = "true" multiValued = "false" required = "true"/>
<Field name = "name" type = "string" indexed = "true" stored = "true" multiValued = "false"/>
<Field name = "url" type = "string" indexed = "true" stored = "true" multiValued = "false"/>

3. Go to the solr management interface, and select "full-import" for "command". The entity object to be imported, that is, the configured SQL, and click execute to execute the import,

Solr3.6.1 build an environment in Tomcat6

Tomcat-based Solr3.5 cluster deployment

Load Balancing for Solr clusters using Nginx on Linux

Install and use Solr in Linux

Deploy Solr 4 on Ubuntu 12.04 LTS through Tomcat

Solr implements Low Level query parsing (QParser)

Build a search Server Based on Solr 3.5

Solr 3.5 development and application tutorial PDF

Solr 4.0 deployment instance tutorial

Solr details: click here
Solr: click here

This article permanently updates the link address:

Related Article

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.