mirror of https://github.com/apache/lucene.git
SOLR-2750: Make both "update.chain" and the deprecated "update.param" work consistently everywhere
git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1171304 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
b25b42ae2c
commit
90e0977c5a
|
@ -346,6 +346,9 @@ Bug Fixes
|
|||
Other Changes
|
||||
----------------------
|
||||
|
||||
* SOLR-2750: Make both "update.chain" and the deprecated "update.param" work
|
||||
consistently everywhere; see also SOLR-2105. (Mark Miller, janhoy)
|
||||
|
||||
* LUCENE-3410: Deprecated the WordDelimiterFilter constructors accepting multiple
|
||||
ints masquerading as booleans. Preferred constructor now accepts a single int
|
||||
bitfield (Chris Male)
|
||||
|
|
|
@ -22,7 +22,6 @@ import org.apache.solr.common.SolrInputDocument;
|
|||
import org.apache.solr.common.params.CommonParams;
|
||||
import org.apache.solr.common.params.ModifiableSolrParams;
|
||||
import org.apache.solr.common.params.SolrParams;
|
||||
import org.apache.solr.common.params.UpdateParams;
|
||||
import org.apache.solr.common.util.ContentStreamBase;
|
||||
import org.apache.solr.common.util.NamedList;
|
||||
import org.apache.solr.common.util.ContentStream;
|
||||
|
@ -39,6 +38,7 @@ import org.apache.solr.response.SolrQueryResponse;
|
|||
import org.apache.solr.request.SolrRequestHandler;
|
||||
import org.apache.solr.update.processor.UpdateRequestProcessor;
|
||||
import org.apache.solr.update.processor.UpdateRequestProcessorChain;
|
||||
import org.apache.solr.util.SolrPluginUtils;
|
||||
import org.apache.solr.util.plugin.SolrCoreAware;
|
||||
|
||||
import java.util.*;
|
||||
|
@ -191,7 +191,7 @@ public class DataImportHandler extends RequestHandlerBase implements
|
|||
IMPORT_CMD.equals(command)) {
|
||||
|
||||
UpdateRequestProcessorChain processorChain =
|
||||
req.getCore().getUpdateProcessingChain(params.get(UpdateParams.UPDATE_CHAIN));
|
||||
req.getCore().getUpdateProcessingChain(SolrPluginUtils.resolveUpdateChainParam(params, LOG));
|
||||
UpdateRequestProcessor processor = processorChain.createProcessor(req, rsp);
|
||||
SolrResourceLoader loader = req.getCore().getResourceLoader();
|
||||
SolrWriter sw = getSolrWriter(processor, loader, requestParams, req);
|
||||
|
|
|
@ -18,12 +18,12 @@ package org.apache.solr.handler;
|
|||
|
||||
import org.apache.solr.common.SolrException;
|
||||
import org.apache.solr.common.params.SolrParams;
|
||||
import org.apache.solr.common.params.UpdateParams;
|
||||
import org.apache.solr.common.util.ContentStream;
|
||||
import org.apache.solr.request.SolrQueryRequest;
|
||||
import org.apache.solr.response.SolrQueryResponse;
|
||||
import org.apache.solr.update.processor.UpdateRequestProcessor;
|
||||
import org.apache.solr.update.processor.UpdateRequestProcessorChain;
|
||||
import org.apache.solr.util.SolrPluginUtils;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
|
@ -38,17 +38,8 @@ public abstract class ContentStreamHandlerBase extends RequestHandlerBase {
|
|||
@Override
|
||||
public void handleRequestBody(SolrQueryRequest req, SolrQueryResponse rsp) throws Exception {
|
||||
SolrParams params = req.getParams();
|
||||
String updateChainName = null;
|
||||
if(params.get(UpdateParams.UPDATE_CHAIN_DEPRECATED) != null) {
|
||||
log.warn("Use of deprecated update request parameter "+UpdateParams.UPDATE_CHAIN_DEPRECATED+
|
||||
" detected. Please use the new parameter "+UpdateParams.UPDATE_CHAIN+" instead, as support"+
|
||||
" for "+UpdateParams.UPDATE_CHAIN_DEPRECATED+" will be removed in a later version.");
|
||||
updateChainName = params.get(UpdateParams.UPDATE_CHAIN_DEPRECATED);
|
||||
} else {
|
||||
updateChainName = params.get(UpdateParams.UPDATE_CHAIN);
|
||||
}
|
||||
UpdateRequestProcessorChain processorChain =
|
||||
req.getCore().getUpdateProcessingChain(updateChainName);
|
||||
req.getCore().getUpdateProcessingChain(SolrPluginUtils.resolveUpdateChainParam(params, log));
|
||||
|
||||
UpdateRequestProcessor processor = processorChain.createProcessor(req, rsp);
|
||||
|
||||
|
|
|
@ -37,6 +37,7 @@ import org.apache.solr.response.SolrQueryResponse;
|
|||
import org.apache.solr.search.SolrIndexSearcher;
|
||||
import org.apache.solr.util.NumberUtils;
|
||||
import org.apache.solr.util.RefCounted;
|
||||
import org.apache.solr.util.SolrPluginUtils;
|
||||
import org.apache.solr.update.MergeIndexesCommand;
|
||||
import org.apache.solr.update.processor.UpdateRequestProcessor;
|
||||
import org.apache.solr.update.processor.UpdateRequestProcessorChain;
|
||||
|
@ -231,7 +232,7 @@ public class CoreAdminHandler extends RequestHandlerBase {
|
|||
}
|
||||
|
||||
UpdateRequestProcessorChain processorChain =
|
||||
core.getUpdateProcessingChain(params.get(UpdateParams.UPDATE_CHAIN));
|
||||
core.getUpdateProcessingChain(SolrPluginUtils.resolveUpdateChainParam(params, log));
|
||||
wrappedReq = new LocalSolrQueryRequest(core, req.getParams());
|
||||
UpdateRequestProcessor processor =
|
||||
processorChain.createProcessor(wrappedReq, rsp);
|
||||
|
|
|
@ -29,6 +29,7 @@ import org.apache.solr.common.params.AppendedSolrParams;
|
|||
import org.apache.solr.common.params.DefaultSolrParams;
|
||||
import org.apache.solr.common.params.SolrParams;
|
||||
import org.apache.solr.common.params.CommonParams;
|
||||
import org.apache.solr.common.params.UpdateParams;
|
||||
import org.apache.solr.common.util.NamedList;
|
||||
import org.apache.solr.common.util.SimpleOrderedMap;
|
||||
import org.apache.solr.common.util.StrUtils;
|
||||
|
@ -42,6 +43,8 @@ import org.apache.solr.schema.IndexSchema;
|
|||
import org.apache.solr.schema.SchemaField;
|
||||
import org.apache.solr.search.*;
|
||||
import org.apache.solr.update.DocumentBuilder;
|
||||
import org.slf4j.Logger;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.*;
|
||||
import java.util.regex.Pattern;
|
||||
|
@ -856,6 +859,28 @@ public class SolrPluginUtils {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* This method helps resolve if the deprecated "update.processor" request parameter is used
|
||||
* and logs a warning if it is. In a future version, this method will be removed and
|
||||
* Solr will assume "update.chain" and not look for "update.processor"
|
||||
* @param params an instance of SolrParams from the request
|
||||
* @param log an instance of a slf4j logger to log a warning in case of deprecated param usage
|
||||
* @return null if neither is specified, else the value of the param specified
|
||||
* @deprecated
|
||||
*/
|
||||
public static String resolveUpdateChainParam(SolrParams params, Logger log) {
|
||||
if(params.get(UpdateParams.UPDATE_CHAIN_DEPRECATED) != null && log != null) {
|
||||
log.warn("Use of deprecated update request parameter "+UpdateParams.UPDATE_CHAIN_DEPRECATED+
|
||||
" detected. Please use the new parameter "+UpdateParams.UPDATE_CHAIN+" instead, as support"+
|
||||
" for "+UpdateParams.UPDATE_CHAIN_DEPRECATED+" will be removed in a later version.");
|
||||
}
|
||||
return (params.get(UpdateParams.UPDATE_CHAIN) != null)
|
||||
? params.get(UpdateParams.UPDATE_CHAIN)
|
||||
: params.get(UpdateParams.UPDATE_CHAIN_DEPRECATED);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue