如何在Solr中使用DataImportHandler处理多个MySQL表?

时间:2017-01-03 09:34:50

标签: mysql indexing solr

下面提到的查询在phpmyadmin上运行时完全正常。我想使用solr完全索引这些表,并使用单个查询生成聚合结果。

"select biblio.biblionumber as 'id', biblio.*, biblioitems.*, items.*, branches.* from biblio
inner join biblioitems ON (biblioitems.biblionumber=biblio.biblionumber)
inner join items ON (items.biblionumber=biblio.biblionumber)
inner join branches ON (branches.uid=items.uid);

我在solr上试了一下但是用这个得不到想要的结果:

<document>
<entity name="id" query="select biblio.biblionumber as 'id', biblio.* from biblio ;">
            <field column="BIBLIONUMBER" name="biblionumber" />
            <field column="AUTHOR" name="author" />
            <field column="TITLE" name="title" />
                <field column="SERIESTITLE" name="seriestitle" />
            <field column="COPYRIGHTDATE" name="copyrightdate" />
            <field column="ABSTRACT" name="abstract" />

            <entity name="id2" query="select biblioitems.biblioitemnumber as 'id2', biblioitems.* from biblioitems where biblionumber='${biblio.id}'">
                <field name="BIBLIOITEMNUMBER" column="biblioitemnumber" />
                <field name="ISBN" column="isbn" />
                <field name="ISSN" column="issn" />
                <field name="PUBLISHERCODE" column="publishercode" />
                <field name="EDITIONSTATEMENT" column="editionstatement" />
                <field name="PAGES" column="pages" />
                <field name="PLACE" column="place" />
                <field name="URL" column="url" />
            </entity>
            <entity name="id3" query="select items.uid as 'id3', items.* from items where biblionumber='${biblio.id}'">
                    <field  name="ITEMNUMBER" column="itemnumber" />
                    <field  name="PRICE" column="price" />
                    <field  name="BARCODE" column="barcode" />
                    <field  name="ENUMCHRON" column="enumchron" />
                    <field  name="UID" column="uid" />
                    <field  name="HOMEBRANCH" column="homebranch" />

                <entity name="id4" query="select branches.uid AS 'id4', branches.* from branches where uid = '${items.id3}'">
                    <field  name="UID" column="uid" />
                    <field  name="BRANCHNAME" column="branchname" />
                </entity>
            </entity>
        </entity>
</document>

当连接操作发挥作用时,结果显示为抽象。我正在努力解决这个问题。

我请求大家帮我解决这个问题。

提前致谢!!!

0 个答案:

没有答案