0

UbuntuでSolr4.0DIH(JDBCコネクタ)を使用しています。次のMySQLJOINクエリをSolrで機能させようとしていますDelta-import

select c.*,u.*,g.* from user u inner join group g on u.bus_grp_id = g.dt_grp_id inner join customer c on c.id = g.dt_id

customerここで、c、u、gは、それぞれテーブルのエイリアスuserですgroup

以下は、data-config.xmlフルインポートとデルタインポートのファイルです。

<entity name="cust" pk="id" query="select c.*,u.*,g.* from user u inner join group g on u.bus_grp_id = g.dt_grp_id inner join customer c on c.id = g.dt_id"
                deltaImportQuery="select c.*,u.*,g.* from user u inner join group g on u.bus_grp_id = g.dt_grp_id inner join customer c on c.id = g.dt_id where c.id='${dih.delta.c.id}'"
                deltaQuery="select id from customer where last_modified &gt; '${dih.last_index_time}'">

                <entity name="grp" pk="dt_id"
                    query="select * from group where dt_id='${cust.c.id}'"
                    deltaQuery="select dt_id from group where last_modified > '${dih.last_index_time}'"
                    parentDeltaQuery="select id from customer where id=${grp.dt_id}" >

                <entity name="usr" pk="bus_grp_id"
                query="select * from user"
                deltaQuery="select bus_grp_id from user where last_modified > '${dih.last_index_time}'"
                parentDeltaQuery="select dt_grp_id from group where dt_grp_id=${usr.bus_grp_id}" >

</entity>
</entity>
</entity>

これfull-importは問題ありませんが、機能しDelta-importていません(デルタインポート後に結果が得られません)。私がこの仕事をしようとしてからほぼ1か月が経ちましたが、できませんでした。

何か助けはありますか?お願いします!

4

1 に答える 1

0

メインエンティティ要素のクエリの場合、つまり

select c.*,u.*,g.* from user u 
inner join group g on u.bus_grp_id = g.dt_grp_id 
inner join customer c on c.id = g.dt_id

Solr でインデックスを作成するために必要なすべてのフィールドを提供していますが、他の 2 つのサブエンティティは必要ないと思います。また、deltaImportQuery にタイプミスがあると思います。を使用dih.delta.idしないでdih.delta.c.idください。

これだけを保持すれば、うまくいくはずです:

<entity 
   name="cust" 
   pk="id" 
   query="select c.*,u.*,g.* from user u 
            inner join group g on u.bus_grp_id = g.dt_grp_id 
            inner join customer c on c.id = g.dt_id"
   deltaImportQuery="select c.*,u.*,g.* from user u 
            inner join group g on u.bus_grp_id = g.dt_grp_id 
            inner join customer c on c.id = g.dt_id 
              where c.id='${dih.delta.id}'"
   deltaQuery="select id from customer 
                where last_modified &gt; '${dih.last_index_time}'" />

フル インポートを実行したらすぐに、ファイル dataimport.properties を確認します。完全なインポートが完了したら、dataimport.properties で見つけた時間よりも長いcustomerテーブルにいくつかのドキュメントがあることを確認して、デルタに実行するデータがあることを確認します。last_modified次に、デルタ インポートを試して、それらのドキュメントのインデックスが再作成されるかどうかを確認します。デルタ インポートでインデックスが作成された数は、以下を参照して確認できます。http://HOST:PORT/solr/CORE/dataimport

于 2013-02-17T04:53:42.223 に答える