SOLR Import XML file

Source: Internet
Author: User
Tags documentation solr solr documentation
< c13>1 Overview

Most applications store data in relational databases, XML files. Searching for such data is a very common application. The so-called Dataimporthandler provides a configurable way to import data to SOLR, which can be imported all at once or incrementally.

Ability to read data in a relational database.

The ability to generate multi-column, multi-table data from a database in the SOLR document in a configurable way

Ability to update SOLR through SOLR documentation

Provides the ability to import all data through a configuration file

Ability to configure time for full import and incremental import

Let's read the XML file and make the index configurable.

The ability to integrate other data sources (for example: ftp,scp,etc) or other forms of documentation (JSON,CSV) into the project as plug-ins.


2.3 Importing an XML file

2.3.1 Configuring import fields

New in the Managed-schema file:

<field name= "Name" type= "string" stored= "true" indexed= "true" omitnorms= "false"/> <field
name= "ISBN" Type= "string" stored= "true" indexed= "true"/>


2.3.2 Editing an import file

<add overwrite= "true" commitwithin= "10000" >
<doc>
<field name= "id" >1</field>
<field name= "ISBN" >ABC1234</field>
<field name= "name" boost= "2" >some book</field>
</doc>
<doc boost= "2.5" >
<field name= "id" >2</field>
<field name= "ISBN" > zyvw9821</field>
<field name= "name" boost= "2" >important book</field>
</doc>
<doc>
<field name= "id" >3</field>
<field name= "ISBN" >NXJS1234</field>
<field name= "name" boost= "2" >some other book</field>
</doc>
</add>

2.3.3 Import

Enter the SOLR directory, such as: G:\solr\example\exampledocs directory;

Java-dtype=text/xml-durl=http://localhost:8983/solr/solr_xml/update  -jar Post.jar   book.xml


After the import is complete, you can query the data in the interface queries, such as:








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.