mirror of https://github.com/apache/lucene.git
SOLR-4788: Multiple Entities DIH delta import: dataimporter.[entityName].last_index_time is empty
git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1500652 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
89ea939a4a
commit
e98616b8f1
|
@ -257,6 +257,9 @@ Bug Fixes
|
|||
case in particular this leads to the index being put in a directory literally named
|
||||
${dir} but on restart the sysvar will be properly dereferenced.
|
||||
|
||||
* SOLR-4788: Multiple Entities DIH delta import: dataimporter.[entityName].last_index_time
|
||||
is empty. (chakming wong, James Dyer via shalin)
|
||||
|
||||
Optimizations
|
||||
----------------------
|
||||
|
||||
|
|
|
@ -134,13 +134,15 @@ public class DocBuilder {
|
|||
indexerNamespace.put(INDEX_START_TIME, dataImporter.getIndexStartTime());
|
||||
indexerNamespace.put("request", new HashMap<String,Object>(reqParams.getRawParams()));
|
||||
for (Entity entity : dataImporter.getConfig().getEntities()) {
|
||||
String key = entity.getName() + "." + SolrWriter.LAST_INDEX_KEY;
|
||||
Object lastIndex = persistedProperties.get(key);
|
||||
if (lastIndex != null && lastIndex instanceof Date) {
|
||||
indexerNamespace.put(key, lastIndex);
|
||||
Map<String, Object> entityNamespace = new HashMap<String, Object>();
|
||||
String key = SolrWriter.LAST_INDEX_KEY;
|
||||
Object lastIndex = persistedProperties.get(entity.getName() + "." + key);
|
||||
if (lastIndex != null) {
|
||||
entityNamespace.put(SolrWriter.LAST_INDEX_KEY, lastIndex);
|
||||
} else {
|
||||
indexerNamespace.put(key, EPOCH);
|
||||
entityNamespace.put(SolrWriter.LAST_INDEX_KEY, EPOCH);
|
||||
}
|
||||
indexerNamespace.put(entity.getName(), entityNamespace);
|
||||
}
|
||||
resolver.addNamespace(ConfigNameConstants.IMPORTER_NS_SHORT, indexerNamespace);
|
||||
resolver.addNamespace(ConfigNameConstants.IMPORTER_NS, indexerNamespace);
|
||||
|
|
|
@ -165,13 +165,13 @@ public class TestSqlEntityProcessorDelta extends AbstractSqlEntityProcessorTestC
|
|||
@Override
|
||||
protected String deltaQueriesPersonTable() {
|
||||
return
|
||||
"deletedPkQuery=''SELECT ID FROM PEOPLE WHERE DELETED='Y' AND last_modified >='${dih.last_index_time}' '' " +
|
||||
"deletedPkQuery=''SELECT ID FROM PEOPLE WHERE DELETED='Y' AND last_modified >='${dih.People.last_index_time}' '' " +
|
||||
"deltaImportQuery=''SELECT ID, NAME, COUNTRY_CODE FROM PEOPLE where ID=${dih.delta.ID} '' " +
|
||||
"deltaQuery=''" +
|
||||
"SELECT ID FROM PEOPLE WHERE DELETED!='Y' AND last_modified >='${dih.last_index_time}' " +
|
||||
"SELECT ID FROM PEOPLE WHERE DELETED!='Y' AND last_modified >='${dih.People.last_index_time}' " +
|
||||
(useParentDeltaQueryParam ? "" :
|
||||
"UNION DISTINCT " +
|
||||
"SELECT ID FROM PEOPLE WHERE DELETED!='Y' AND COUNTRY_CODE IN (SELECT CODE FROM COUNTRIES WHERE last_modified >='${dih.last_index_time}') "
|
||||
"SELECT ID FROM PEOPLE WHERE DELETED!='Y' AND COUNTRY_CODE IN (SELECT CODE FROM COUNTRIES WHERE last_modified >='${dih.People.last_index_time}') "
|
||||
) + "'' "
|
||||
;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue