2016-05-01 4 views
0

MySQLデータベースからSolr delta-importに問題があります。私は完全な輸入を問題なく行うことができます。デルタインポートを実行しようとすると、変更されたレコードが(期待通りに)インポートされますが、残りのインデックスは消去されるため、更新されたレコードのみがインデックスに格納されます。ログにエラーはありません。私の設定で何かが欠けていますか? UbuntuサーバーでSolr 5.4を実行し、管理UIを使用する。Solr delta-importはインデックスを消去します

<dataConfig> 
    <dataSource driver="com.mysql.jdbc.Driver" url="jdbc:mysql://localhost/ibnet" user="xxxx" password="xxxxx" /> 
    <document> 
    <entity name="profile" pk="profile.id" query=" 
     SELECT 
      profile.id AS id, 
      profile.profile_status AS profile_status, 
      // 
      // Other fields 
      // 
      linkedProfile.org_name AS linked_org_name, 
      linkedProfile.org_city AS linked_org_city, 
      linkedProfile.org_st_prov_reg AS linked_org_st_prov_reg, 
      linkedProfile.org_country AS linked_org_country 
     FROM profile AS profile 
     LEFT JOIN profile AS linkedProfile ON linkedProfile.id = profile.linked_id" 
     deltaImportQuery=" 
      SELECT 
       profile.id AS id, 
       profile.profile_status AS profile_status, 
       // 
       // Other fields 
       // 
       linkedProfile.org_name AS linked_org_name, 
       linkedProfile.org_city AS linked_org_city, 
       linkedProfile.org_st_prov_reg AS linked_org_st_prov_reg, 
       linkedProfile.org_country AS linked_org_country 
      FROM profile AS profile 
      LEFT JOIN profile AS linkedProfile ON linkedProfile.id = profile.linked_id 
      WHERE profile.id = '${dih.delta.id}'" 
     deltaQuery="SELECT profile.id FROM profile WHERE last_modified > '${dih.last_index_time}'" 
     onError="skip" > 
    </entity> 
</document> 

編集:私はdataimporter.delta.idするdih.delta.id変更と同じlast_index_timeのために、それは結果を変更されていませんしました。ここで

は応答である:Solrの管理者で

{ 
    "responseHeader": { 
    "status": 0, 
    "QTime": 0 
    }, 
    "initArgs": [ 
    "defaults", 
    [ 
     "config", 
     "data-config.xml" 
    ] 
    ], 
    "command": "status", 
    "status": "idle", 
    "importResponse": "", 
    "statusMessages": { 
    "Total Requests made to DataSource": "4", 
    "Total Rows Fetched": "6", 
    "Total Documents Processed": "3", 
    "Total Documents Skipped": "0", 
    "Delta Dump started": "2016-05-01 02:38:03", 
    "Identifying Delta": "2016-05-01 02:38:03", 
    "Deltas Obtained": "2016-05-01 02:38:03", 
    "Building documents": "2016-05-01 02:38:03", 
    "Total Changed Documents": "3", 
    "": "Indexing completed. Added/Updated: 3 documents. Deleted 0 documents.", 
    "Committed": "2016-05-01 02:38:03", 
    "Time taken": "0:0:0.317" 
    } 
} 
+0

solr adminの最初のオプションを確認しましたか? –

+0

そして、xmlの特殊文字なので、sqlの '>'を '>'に変更してください。 –

+0

明確なオプションはどこですか?私は>に変更し、 'processor =" SqlEntityProcessor "'も追加しました。 – SM0827

答えて

1

- >あなたの心は - > dataimport、Cleanオプションがあり、確認された場合、それは、インポートする前に、まずデータをきれいにする(フルインポートの両方のためにとデルタインポート)。

もう一つのヒントは、DIHは常にインポートタイムスタンプとしてUTCを使用することです。あなたのタイムゾーンは何ですか?データベースのdatetimeカラムをutcに変換してから、dih.last_index_timeと比較してください。

+0

タイムゾーンについてのヒントをありがとう。これは今のところ問題ではありませんが、私は道に沿って何か問題が起きるのを避けるために釘付けにします。 – SM0827

関連する問題