您的位置:首页 > 其它

solr创建多表关联索引时子表的索引创建失败

2016-02-02 18:35 330 查看
1、data-config.xml配置如下:

<?xml version="1.0" encoding="UTF-8"?>
<dataConfig>
<dataSource type="JdbcDataSource"
driver="oracle.jdbc.driver.OracleDriver"
url="jdbc:oracle:thin:@133.96.93.111:1521:ARS"
user="usddev"
password="usddev"/>
<document>
<entity name="sys_user" PK="ID"
query="select ID,loginname,
nvl(fullname,'无')fullname,
createdate,phone,mail,fax,(case position
when '0' then '员工'
when '1' then '组长'
when '2' then '处长'
when '3' then '副处长'
when '4' then '部长'
when '5' then '副部长'
when '6' then '其他'
when '7' then '经理'
when '8' then '主管'
when '9' then '主任'
else '无'
END) position ,
(case status
when 0 then '启用'
when 1 then '停用'
else '无'
End
) status,DEPARTID
from sys_user">
<field column="id" name="id"/>
<field column="loginname" name="loginname"/>
<field column="fullname" name="fullname"/>
<field column="createdate" name="createDate"/>
<field column="phone" name="phone"/>
<field column="mail" name="mail"/>
<field column="fax" name="fax"/>
<field column="position" name="position"/>
<field column="status" name="status"/>
<field column="DEPARTID" name="departid"/>
<entity name="sys_group" PK="ID"
query="select ID,
name,
nvl(fullname,'无')fullname
from sys_group  where id ='${sys_user.DEPARTID}'">
<field column="name" name="groupname"/>
<field column="fullname" name="groupfullname"/>

</entity>
</entity>

</document>
</dataConfig>


2.schema.xml酣置如下:

<field name="groupname" type="mmseg4jcomplex" indexed="true" stored="true"/>
<pre name="code" class="html"> <field name="groupfullname" type="mmseg4jcomplex" indexed="true" stored="true"/>




3.生成的索引数据:

并没有:groupname、groupfullname两个字段。

原因:索引字段名称要与数据库字段名称一致,如果两个表有相同的字段名则要在字段后加   multiValued="true"

解决:

1.data-config.xml 修改如下:



2.schema.xml修改如下:



然后重新启动solr并重新生成索引文件。

生成的结果如下:

内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: