需求:从mysql数据库中读取一个知识记录,从记录表中的字段值中获取一个文件路径,读取xml文件,xml文件中可能包含多个文档内容。建立索引。

xml文件样例:

<?xml version="1.0" encoding="utf-8"?>
<docs>
<data>
<id>1</id>
<title>测试数据</title>
<content>测试内容</content>
<crtime>2014-10-13 16:10:33</crtime>
<templateid>201</templateid>
<price>12.11</price>
</data>
<data>
<id>2</id>
<title>测试数据1</title>
<content>测试内容1</content>
<crtime>2014-10-12 16:10:33</crtime>
<templateid>202</templateid>
<price>20.11</price>
</data>
</docs>

mysql数据格式样例:

CREATE TABLE `gx_kmsindex` (
`id` BIGINT(20) NOT NULL AUTO_INCREMENT COMMENT '主键ID',
`docid` BIGINT(20) COMMENT '知识ID',
`path` VARCHAR(200) DEFAULT NULL COMMENT '知识xml文件路径',
`templateid` VARCHAR(20) NOT NULL COMMENT '知识模板id',
`time` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '创建时间',
`type` VARCHAR(20) NOT NULL COMMENT '知识操作类型,add/update/delete',
PRIMARY KEY (`id`)
) ENGINE=INNODB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8

当为新增、更新知识时,docid可以为空,当为删除知识时,docid为必填项。

aaarticlea/png;base64,iVBORw0KGgoAAAANSUhEUgAAAy8AAAAqCAIAAAA1avNJAAANzUlEQVR4nO1cTWscyRnuH7MfiZEOthNB+pDTEhALQYLsrhMTLNi4BXuIEPhizJosAiuHKLQPS2CxdoMPC5bX4INpHKH1IhRbaKxvS0hWh8XEGDY5xCMn986hu6uqq96qrpn+mJme5+HBjGuqut6Pfqufrm6N8+OffSBy//k/QdDAV2uXox++LsJXa5d77gUIgiAIWvL4H69e/ut1pXSgxsCO+GrtcnH23AsQBEEQ7B9CjYEgCIIgCPaSUGMgCIIgCIK9JNQYCIIgCIJgLwk1BoIgCIIg2EvKauyvAAAAAAAAQF2IoohQY+0yEE9QyqF6CzgCAIAKFJQBCE5jgFTWAJMa23jys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UbGuMIAPQDUFAGIDiNAVJZA7RqrCw8AAAAAABgYOEAtSCKov8DwSfZrjSat94AAAAASUVORK5CYII=" alt="" />

处理方案:

1、schema.xml中配置field:

<field name="id" type="string" indexed="true" stored="true"  required="true"/>
<field name="_version_" type="long" indexed="true" stored="true"/>
<field name="title" type="text_ik" indexed="true" stored="true" termVectors="true"/>
<field name="content" type="text_ik" indexed="true" stored="true" termVectors="true"/> <field name="crtime" type="date" indexed="true" stored="true" />
<field name="templateid" type="string" indexed="true" stored="true" />
<field name="price" type="double" indexed="true" stored="true" />

2、solrconfig.xml中配置handler:

<requestHandler name="/dataimport" class="org.apache.solr.handler.dataimport.DataImportHandler">
<lst name="defaults">
<str name="config">mysql-data-config.xml</str>
</lst>
</requestHandler>

3、配置mysql-data-config.xml

<dataConfig>
<dataSource name="jdbc" type="JdbcDataSource" driver="com.mysql.jdbc.Driver"
batchSize="-1" url="jdbc:mysql://127.0.0.1:3306/test?characterEncoding=UTF-8"
user="root" password="root" />
<dataSource name="file" type="FileDataSource" encoding="utf-8" />
<document>
<entity name="kms" dataSource="jdbc"
query="SELECT path FROM gx_kmsindex ORDER BY TIME ASC" transformer="DateFormatTransformer">
<entity dataSource="file" name="xml" url="${kms.path}"
processor="XPathEntityProcessor" forEach="/docs/data/" transformer="DateFormatTransformer">
<field column="id" xpath="/docs/data/id" />
<field column="title" xpath="/docs/data/title" />
<field column="content" xpath="/docs/data/content" />
<field column="crtime" xpath="/docs/data/crtime"
dateTimeFormat="yyyy-MM-dd HH:mm:ss" />
<field column="templateid" xpath="/docs/data/templateid" />
<field column="price" xpath="/docs/data/price" />
</entity>
</entity>
</document>
</dataConfig>

4、在后台建立索引,发现只抽取了一条数据记录。

aaarticlea/png;base64,iVBORw0KGgoAAAANSUhEUgAAASUAAAELCAIAAAAQowdmAAAPaUlEQVR4nO3d3XGrOhSGYXWkiuglt7pKB7sEDx2kCU3a0b6QLcv6AYHFAsXvM2f2xAQBSfwdgYwWygGQos4+AOCDkDd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5cdTPML1H/Nsg+UtL17gOzGtdbgd2RhTq32QlzkoVl4o7uiIn2ZT7QMfzrDCc3JNcgoXtcq33NLqfnD/lHrtcFby9jPpm5mS8+SixSOsyY8nXxJ1bhc1Ut5qJQlCNpJH3RenURenXRcrLxSrJHT8abbVPnj0Hpv6t/Z3c2Ue6ss53nLe7E2r6GS4cV8bjjA7nnzJxTs3N1bealW0assb85bPBF+oktDrR9lc++DXzmGU5av13bz7fDK4n/Hev17t355f9z/C7HjSJdGmLmukvMX9m4+E73aW8xZqH3gteVuoktDl53in9sG267falpdbPd+4YUSnsuvXHlg/+7f2bDccYX48hSOMDjWMnVzPSHlzryUJfB6SKnfxyvkE07zMQa3yQrFKQolo7YPwQcL0U952odWW0fZHq+fY+nNHLUf4+NFeBy1fLufajjBplR9PtuTlt3qVT9tyg+UNGBp5A+SQN0AOeQPkkDdADnkD5JA3QA55A+SQN0AOeQPknJS37XdBAX/Aif0bD2LBxyFvgJwz8zZxQokPc+Z4iS93deIBAMLo3wA5XL8BcsgbIOe8vL1RyBUY1ImfdzNWgo/D/VyAHPIGyCFvgBzyBsghb4Ac8gbIIW+AHPIGyCFvgJwD8mbN/ZEz3P4PvDquf7PGkDfgBXkD5JA3QA55A+SQN0AOeQPkkDdADnkD5PB5NyCH+7kAOeQNkEPeADnkDZBD3gA55A2QQ94AOeQNkEPeADnkDZCzMW/WaO7TAvba0b/xnERgJ/IGyNmTN55zD+yzZ7zEGs2zSYEd6N8AOVy/AXLIGyBne96smcgbsMuOz7sZKwF24n4uQA55A+T8B6u9QCmCBk0tAAAAAElFTkSuQmCC" alt="" />

按照道理,应该两条数据都能抽取。经过排查,是rootEntity属性的问题。在kms实体中,没有设置rootEntity属性,默认为true的。这样就把gx_kmsindex当作了根实体,

rootEntity="true" 表示它的文档会被Solr索引。如果rootEntity属性被显式地设置为false,那么DIH会反向查找,直到找到一个实体配置没有设置为false的。可以有子实体(sub-entities),它通常为每个父文档执行一次,并通常由父文档引用来缩小查找范围。子实体的文档会合并到根实体的文档中,如果多个子实体对相同的域产生了多个文档,那么根实体会产生一个多值域。

这里kms实体的rootEntity属性应该设置为“false”。xml实体才是用于索引的数据实体。所以xml实体rootEntity属性为true。这里采用默认属性值即可。修改后的mysql-data-config.xml:

<dataConfig>
<dataSource name="jdbc" type="JdbcDataSource" driver="com.mysql.jdbc.Driver" batchSize="-1"
url="jdbc:mysql://127.0.0.1:3306/test?characterEncoding=UTF-8" user="root" password="root"/>
<dataSource name="file" type="FileDataSource" encoding="utf-8" />
<document>
<entity name="kms" dataSource="jdbc" query="SELECT path FROM gx_kmsindex ORDER BY TIME ASC"
transformer="DateFormatTransformer" rootEntity="false">
<entity dataSource="file" name="xml" url="${kms.path}" processor="XPathEntityProcessor"
forEach="/docs/data/" transformer="DateFormatTransformer" >
<field column="id" xpath="/docs/data/id" />
<field column="title" xpath="/docs/data/title" />
<field column="content" xpath="/docs/data/content" />
<field column="crtime" xpath="/docs/data/crtime" dateTimeFormat="yyyy-MM-dd HH:mm:ss"/>
<field column="templateid" xpath="/docs/data/templateid" />
<field column="price" xpath="/docs/data/price" />
</entity>
</entity>
</document>
</dataConfig>

5、修改后,重新建立索引:

aaarticlea/png;base64,iVBORw0KGgoAAAANSUhEUgAAATwAAAFuCAIAAACTITOtAAAWsUlEQVR4nO2d0XHjIBgG6YiK1ItfeUoHKcFDB2mCcTvcAzZGAiQko5N+a3dubmwCEk6yAWTxWXkAEIU6ugMAsA6kBRAG0gIIY5W0dlDaODuowe7Vn+1nsYNSSimljdurZwBnYIW0zmhtnDN6ItMwPHXp0qHaWRaxBlvhErSbZo1x3pmhpIbWupO0c2dpaAnw/fQZHvtJW8QZrRYny0gLF+Ej04wxKiEvNMaEQmttXpjW1Fp/0hOPtHAZtkvrnIuyxZE2FA7D4F9rXedcsWZ4HApDzQ9fCdLCRdiuShg8w7AZVQyDp7U2rZDWTAkyB5z71DikhYvw6UgbBtU4PQ5+piOttTYdaUOFoOjE+Q+9RVq4CD3XtMHV4po2L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OnwBSDaYon2uPVLETDjKUN/sQKcX6oJjPSpFV+5JZWeQ8Lfctb/Q36bobJtL/IbA9r2F+lxkNxXpIMs+D9GaStJbZEweKm9kAxIKIYKFEMpimGyHR8NcvRMKVxbNVI265ESdppMM28tO6uVTK3bzzXih56X5pCj0oYZiccL20tM7FW3ihtnnExEyLT66U0RMNMpHU2Xhy6tSqxcXqc99B73zTSvh/37+GzD9McyXdJcigIHC9tOtIGr8IAOC9tjIYJtEg7EyLT5XU0RMN478tT1nVr2tqRF1qVg2kW17T6PdK2/4Fo6OHbxtelu7zk/SC5KHV5jpfWjxNbglSTYNS0cr7rPU+BqQXTFENkSuwTDZMuWZMrsfGdmOGvfOxCqzVvqDxbbe7hq+HY/9ESt62Hk1bvt3NeLzwrGfX5ou/K5pxCWgBoB2kBhIG0AMJAWgBhIC2AMJAWQBhICyAMpAUQBtICCANpAYSBtADC6Crt+jt2AWAt/T+5nM9UBNgVpAUQRn9pB+bHAHvS/0JUSCTtflgACDDSAgiDNS2AMJAWQBi9pf3gowMAoIXuN1dwEQpgX7iNEUAYSAsgDKQFEAbSAggDaQGEgbQAwkBaAGEgLYAwkBZAGM3SOvP89Eg28QAcytqR1hmDtABHgrQAwkBaAGEgLYAwkBZAGEgLIAykBRAG0gIIg5srAITBbYwAwkBaAGEgLYAwkBZAGEgLIAykBRAG0gIIA2kBhIG0AMJQ3j/vduJOJwARxJGWz5UFkAHSAgjjLe3A/BhAAu8LUc5oPhAa4Pww0gIIgzUtgDCQFkAYL2mdGZAWQALx5gouQgHIgNsYAYSBtADCQFoAYSAtgDCQFkAYSAsgjH8nq+4Uf+687QAAAABJRU5ErkJggg==" alt="" />

DIH中添加不同的数据源的更多相关文章

  1. [Asp.net MVC]Asp.net MVC5系列——在模型中添加验证规则

    目录 概述 在模型中添加验证规则 自定义验证规则 伙伴类的使用 总结 系列文章 [Asp.net MVC]Asp.net MVC5系列——第一个项目 [Asp.net MVC]Asp.net MVC5 ...

  2. DataGridView 中添加CheckBox和常用处理方式 .

    DataGridView 中添加CheckBox和常用处理方式 文章1 转载:http://blog.csdn.net/pinkey1987/article/details/5267934 DataG ...

  3. 如何管理和记录 SSIS 各个 Task 的开始执行时间和结束时间以及 Task 中添加|删除|修改的记录数

    开篇语 在这篇日志中 如何在 ETL 项目中统一管理上百个 SSIS 包的日志和包配置框架 我介绍到了包级别的日志管理框架,那么这个主要是针对包这一个层级的 Log 信息,包括包开始执行和结束时间,以 ...

  4. extjs在窗体中添加搜索框

    在extjs中添加搜索框,搜索框代码如下: this.searchField = new Ext.ux.form.SearchField({            store : this.store ...

  5. 关于32位程序在Win7&64位系统中连接Microsoft Excel数据源的问题

    最近在新公司电脑上跑以前的selenium测试框架的时候,抛出了如下的错误 出现的是ODBC Driver问题:[Microsoft][ODBC Driver Manager] Data source ...

  6. 怎样在UICollectionView中添加Header和footer

    ---恢复内容开始--- 怎样在UICollectionView中添加Header和footer 转载于http://my.oschina.net/zboy/blog/221525 摘要 来自-htt ...

  7. 007.Adding a view to an ASP.NET Core MVC app -- 【在asp.net core mvc中添加视图】

    Adding a view to an ASP.NET Core MVC app 在asp.net core mvc中添加视图 2017-3-4 7 分钟阅读时长 本文内容 1.Changing vi ...

  8. spring 中连接多个数据源

    http://www.ityouknow.com/springboot/2016/08/20/springboot(%E4%BA%94)-spring-data-jpa%E7%9A%84%E4%BD% ...

  9. Asp.net MVC]Asp.net MVC5系列——在模型中添加

    目录 概述 在模型中添加验证规则 自定义验证规则 伙伴类的使用 总结 系列文章 [Asp.net MVC]Asp.net MVC5系列——第一个项目 [Asp.net MVC]Asp.net MVC5 ...

随机推荐

  1. cocos2d-x 3.2读取xml和json练习

    读取和生成xml文件: #include "tinyxml2/tinyxml2.h" using namespace tinyxml2; void HelloWorld::make ...

  2. 微软IOC容器Unity简单代码示例2-配置文件方式

    @(编程) 1. 通过Nuget下载Unity 这个就不介绍了 2. 接口代码 namespace UnityDemo { interface ILogIn { void Login(); } } n ...

  3. socket的异步回调函数,采用一问一答

    socket.Send(buf); AsyncCallback callback = new AsyncCallback(ReceiveData5); mysocket.BeginReceive(Wi ...

  4. 解决WebService 中泛型接口不能序列化问题

    本来要定义WebServices 方法返回一泛型接口集合IList,系统提示不能序列化泛型接口集合  1   [WebMethod]  2         public IList<Employ ...

  5. js 对象与函数的区别

    <!DOCTYPE html> <html> <head lang="en"> <meta charset="UTF-8&quo ...

  6. wikioi 1083 Cantor表

    题目描述 Description 现代数学的著名证明之一是Georg Cantor证明了有理数是可枚举的.他是用下面这一张表来证明这一命题的: 1/1 1/2 1/3 1/4 1/5 - 2/1 2/ ...

  7. php中curl不支持https的解决办法

    在php程序中使用curl去访问https站点时,报错:Protocol https not supported or disabled in libcurl 该错误信息表示php当时编译时使用的cu ...

  8. STM32 DFU -- Device Firmware Upgrade

    DFU Class Requests Get Status The Host employs the DFU_GETSTATUS request to facilitate synchronizati ...

  9. MySQL 多会话之间更新数据的小实例

    1:创建一个实验表 mysql> use test; mysql> CREATE TABLE t -> (id int(11) NOT NULL DEFAULT 0, -> n ...

  10. Codeforces Round #188 (Div. 1) B. Ants 暴力

    B. Ants Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/317/problem/B Des ...