SOLR-1153 deltaImportQuery should be honored on child entities as well

git-svn-id: https://svn.apache.org/repos/asf/lucene/solr/trunk@776958 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Noble Paul 2009-05-21 05:52:48 +00:00
parent b54b936fcd
commit 6fe805f80b
2 changed files with 7 additions and 7 deletions

View File

@ -142,6 +142,7 @@ New Features
32.SOLR-1092: Added a new command named 'import' which does not automatically clean the index. This is useful and 32.SOLR-1092: Added a new command named 'import' which does not automatically clean the index. This is useful and
more appropriate when one needs to import only some of the entities. more appropriate when one needs to import only some of the entities.
(Noble Paul via shalin) (Noble Paul via shalin)
33.SOLR-11153: 'deltaImportQuery' is honored on child entities as well (noble)
Optimizations Optimizations
---------------------- ----------------------

View File

@ -107,18 +107,17 @@ public class SqlEntityProcessor extends EntityProcessorBase {
public String getQuery() { public String getQuery() {
String queryString = context.getEntityAttribute(QUERY); String queryString = context.getEntityAttribute(QUERY);
if (context.currentProcess() == Context.FULL_DUMP if (Context.FULL_DUMP.equals(context.currentProcess())) {
|| !context.isRootEntity()) {
return queryString; return queryString;
} }
if (Context.DELTA_DUMP.equals(context.currentProcess())) {
String deltaImportQuery = context.getEntityAttribute(DELTA_IMPORT_QUERY);
if(deltaImportQuery != null) return deltaImportQuery;
}
return getDeltaImportQuery(queryString); return getDeltaImportQuery(queryString);
} }
public String getDeltaImportQuery(String queryString) { public String getDeltaImportQuery(String queryString) {
String deltaImportQuery = context.getEntityAttribute(DELTA_IMPORT_QUERY);
if(deltaImportQuery != null){
return resolver.replaceTokens(deltaImportQuery);
}
StringBuilder sb = new StringBuilder(queryString); StringBuilder sb = new StringBuilder(queryString);
if (SELECT_WHERE_PATTERN.matcher(queryString).find()) { if (SELECT_WHERE_PATTERN.matcher(queryString).find()) {
sb.append(" and "); sb.append(" and ");