0
我正在嘗試從數據庫索引數據。我正在成功地做到這一點。但我有一個問題。我想爲整個數據庫使用一個索引。所有的數據庫表至少有3列同名(我想這樣)。例如,我有這些表格:會員,新會員,書籍,期刊和光盤。所有這些列名爲:id,model,biog。所以,在所有的數據庫表中,id(自動遞增)從1開始。 當我使用filter(fq = model:journal)查詢Solr時,它不返回任何內容。查詢書籍返回一部分數據(我有5行,它返回2.我使用:爲了檢索所有行)。我知道這些數據在Solr的「數據」文件中。我認爲有某種衝突。 如何使用所有這些表的單個索引沒有任何衝突?從數據庫索引數據
數據-config.xml中:
<?xml version="1.0" encoding="utf-8"?>
<dataConfig>
<dataSource type="JdbcDataSource"
driver="com.mysql.jdbc.Driver"
url="jdbc:mysql://127.0.0.1:3306/rental"
user="root"
password="1a2b3c4d"/>
<document>
<entity name="members" pk="id" transformer="HTMLStripTransformer" query="select id, firstname, lastname, biog, model from members">
<field column="id" name="id" />
<field column="firstname" name="firstname" stripHTML="true" />
<field column="lastname" name="lastname" stripHTML="true" />
<field column="biog" name="biog" stripHTML="true" />
<field column="model" name="model" stripHTML="true" />
</entity>
<entity name="new_members" pk="id" transformer="HTMLStripTransformer" query="select id, firstname, lastname, biog, model from new_members">
<field column="id" name="id" />
<field column="firstname" name="firstname" stripHTML="true" />
<field column="lastname" name="lastname" stripHTML="true" />
<field column="biog" name="biog" stripHTML="true" />
<field column="model" name="model" stripHTML="true" />
</entity>
<entity name="books" pk="id" transformer="HTMLStripTransformer" query="select id, title, description, model from books">
<field column="id" name="id" />
<field column="title" name="title" stripHTML="true" />
<field column="description" name="biog" stripHTML="true" />
<field column="model" name="model" stripHTML="true" />
</entity>
<entity name="journals" pk="id" transformer="HTMLStripTransformer" query="select id, title, description, model from journals">
<field column="id" name="id" />
<field column="title" name="title" stripHTML="true" />
<field column="description" name="biog" stripHTML="true" />
<field column="model" name="model" stripHTML="true" />
</entity>
<entity name="cds" pk="id" transformer="HTMLStripTransformer" query="select id, title, description, model from cd">
<field column="id" name="id" />
<field column="title" name="title" stripHTML="true" />
<field column="description" name="biog" stripHTML="true" />
<field column="model" name="model" stripHTML="true" />
</entity>
</document>
</dataConfig>
schema.xml中(場):
<fields>
<field name="id" type="string" indexed="true" stored="true" />
<field name="model" type="text_en" indexed="true" stored="true" />
<field name="firstname" type="text_en" indexed="true" stored="true"/>
<field name="lastname" type="text_en" indexed="true" stored="true"/>
<field name="title" type="text_en" indexed="true" stored="true"/>
<field name="biog" type="text_en" indexed="true" stored="true"/>
</fields>
<uniqueKey>id</uniqueKey>
<defaultSearchField> biog </defaultSearchField>