2016-05-01 13 views
0

Ich habe Probleme mit Solr Delta-Import von MySQL-Datenbank. Ich kann einen vollständigen Import kein Problem machen. Wenn ich versuche, Delta-Import durchzuführen, importiert es (wie erwartet) die geänderten Datensätze, löscht jedoch den Rest des Indexes, sodass nur die aktualisierten Datensätze im Index enthalten sind. Es gibt keine Fehler im Protokoll. Fehle ich etwas in meiner Konfiguration? Solr 5.4 auf Ubuntu-Server ausführen und die Admin-Benutzeroberfläche verwenden.Solr Delta-Import löscht Index

<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> 

EDIT: Ich habe dih.delta.id geändert für last_index_time dataimporter.delta.id und das gleiche, aber dass die Ergebnisse nicht geändert hat. Hier

ist die Antwort:

{ 
    "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

Haben Sie die erste Option in solr admin überprüft? –

+0

Und, ändern Sie die '>' in sql in '>', weil es eine spezielle Char von XML ist. –

+0

Wo ist die klare Option? Ich änderte> zu > und fügte auch 'Prozessor =" SqlEntityProcessor "' hinzu. – SM0827

Antwort

1

In solr Admin -> Ihr Kern -> Datenimport, gibt es eine ist Clean Option geprüft, ob dann wird es Daten reinigen, bevor Import (für beide Voll Import und Delta-Import).

Ein weiterer Tipp ist, dass Solr DIH immer UTC als Import-Timestamp verwenden, also was ist Ihre Zeitzone? Konvertieren Sie Ihre Datetime-Spalten in der Datenbank zuerst in utc, bevor Sie sie mit dih.last_index_time vergleichen.

+0

Danke für den Tipp über Zeitzone. Das ist im Moment kein Problem, aber ich werde das Problem lösen, um Probleme auf der Straße zu vermeiden. – SM0827