相关疑难解决方法(0)

如何使用单个solr实例或Solr Template字段无法正常工作来索引和搜索位于同一数据源中的两个不同表

我想索引并搜索两个不同的实体.

文件名:db-data-config.xml

<dataConfig>
    <dataSource name="myindex" driver="com.microsoft.sqlserver.jdbc.SQLServerDriver" url="jdbc:sqlserver://test-pc:1433;DatabaseName=SampleDB" user="username" password="password" />
    <document>


     <entity name="Employees" query="select * from employee" transformer="TemplateTransformer" dataSource="myindex">
            <field column="id" name="singlekey" />
            <field column="eId" name="eid" />
            <field column="eName" name="ename" />
            <field column="entity" template="Employee" name="entity" />
    </entity>

    <entity name="Products" query="select * from products" transformer="TemplateTransformer" dataSource="myindex">
            <field column="id" name="singlekey" />
            <field column="pId" name="pid" />
            <field column="pName" name="pname" />
            <field column="entity" template="Product" name="entity" />
    </entity>

</document>
Run Code Online (Sandbox Code Playgroud)

文件名:schema.xml

<?xml version="1.0" encoding="UTF-8" ?>
<schema name="db" version="1.1">
  <types>
    <fieldType name="string" class="solr.StrField" sortMissingLast="true" omitNorms="true"/> …
Run Code Online (Sandbox Code Playgroud)

xml indexing solr data-import dataimporthandler

8
推荐指数
1
解决办法
1442
查看次数

标签 统计

data-import ×1

dataimporthandler ×1

indexing ×1

solr ×1

xml ×1