lucene-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jan...@apache.org
Subject svn commit: r1171306 - in /lucene/dev/branches/branch_3x/solr: ./ contrib/dataimporthandler/src/java/org/apache/solr/handler/dataimport/ core/src/java/org/apache/solr/handler/ core/src/java/org/apache/solr/handler/admin/ core/src/java/org/apache/solr/u...
Date Thu, 15 Sep 2011 22:43:33 GMT
Author: janhoy
Date: Thu Sep 15 22:43:33 2011
New Revision: 1171306

URL: http://svn.apache.org/viewvc?rev=1171306&view=rev
Log:
SOLR-2750: Make both "update.chain" and the deprecated "update.param" work consistently everywhere

Modified:
    lucene/dev/branches/branch_3x/solr/CHANGES.txt
    lucene/dev/branches/branch_3x/solr/contrib/dataimporthandler/src/java/org/apache/solr/handler/dataimport/DataImportHandler.java
    lucene/dev/branches/branch_3x/solr/core/src/java/org/apache/solr/handler/ContentStreamHandlerBase.java
    lucene/dev/branches/branch_3x/solr/core/src/java/org/apache/solr/handler/admin/CoreAdminHandler.java
    lucene/dev/branches/branch_3x/solr/core/src/java/org/apache/solr/util/SolrPluginUtils.java

Modified: lucene/dev/branches/branch_3x/solr/CHANGES.txt
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_3x/solr/CHANGES.txt?rev=1171306&r1=1171305&r2=1171306&view=diff
==============================================================================
--- lucene/dev/branches/branch_3x/solr/CHANGES.txt (original)
+++ lucene/dev/branches/branch_3x/solr/CHANGES.txt Thu Sep 15 22:43:33 2011
@@ -47,6 +47,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)

Modified: lucene/dev/branches/branch_3x/solr/contrib/dataimporthandler/src/java/org/apache/solr/handler/dataimport/DataImportHandler.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_3x/solr/contrib/dataimporthandler/src/java/org/apache/solr/handler/dataimport/DataImportHandler.java?rev=1171306&r1=1171305&r2=1171306&view=diff
==============================================================================
--- lucene/dev/branches/branch_3x/solr/contrib/dataimporthandler/src/java/org/apache/solr/handler/dataimport/DataImportHandler.java
(original)
+++ lucene/dev/branches/branch_3x/solr/contrib/dataimporthandler/src/java/org/apache/solr/handler/dataimport/DataImportHandler.java
Thu Sep 15 22:43:33 2011
@@ -39,6 +39,7 @@ import org.apache.solr.response.SolrQuer
 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.*;
@@ -194,7 +195,7 @@ public class DataImportHandler extends R
               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);

Modified: lucene/dev/branches/branch_3x/solr/core/src/java/org/apache/solr/handler/ContentStreamHandlerBase.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_3x/solr/core/src/java/org/apache/solr/handler/ContentStreamHandlerBase.java?rev=1171306&r1=1171305&r2=1171306&view=diff
==============================================================================
--- lucene/dev/branches/branch_3x/solr/core/src/java/org/apache/solr/handler/ContentStreamHandlerBase.java
(original)
+++ lucene/dev/branches/branch_3x/solr/core/src/java/org/apache/solr/handler/ContentStreamHandlerBase.java
Thu Sep 15 22:43:33 2011
@@ -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 ContentStreamHandl
   @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);
 

Modified: lucene/dev/branches/branch_3x/solr/core/src/java/org/apache/solr/handler/admin/CoreAdminHandler.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_3x/solr/core/src/java/org/apache/solr/handler/admin/CoreAdminHandler.java?rev=1171306&r1=1171305&r2=1171306&view=diff
==============================================================================
--- lucene/dev/branches/branch_3x/solr/core/src/java/org/apache/solr/handler/admin/CoreAdminHandler.java
(original)
+++ lucene/dev/branches/branch_3x/solr/core/src/java/org/apache/solr/handler/admin/CoreAdminHandler.java
Thu Sep 15 22:43:33 2011
@@ -33,6 +33,7 @@ import org.apache.solr.request.LocalSolr
 import org.apache.solr.response.SolrQueryResponse;
 import org.apache.solr.search.SolrIndexSearcher;
 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;
@@ -222,7 +223,7 @@ public class CoreAdminHandler extends Re
         }
 
         UpdateRequestProcessorChain processorChain =
-                core.getUpdateProcessingChain(params.get(UpdateParams.UPDATE_CHAIN));
+                core.getUpdateProcessingChain(SolrPluginUtils.resolveUpdateChainParam(params,
log));
         SolrQueryRequest wrappedReq = new LocalSolrQueryRequest(core, req.getParams());
         UpdateRequestProcessor processor =
                 processorChain.createProcessor(wrappedReq, rsp);

Modified: lucene/dev/branches/branch_3x/solr/core/src/java/org/apache/solr/util/SolrPluginUtils.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_3x/solr/core/src/java/org/apache/solr/util/SolrPluginUtils.java?rev=1171306&r1=1171305&r2=1171306&view=diff
==============================================================================
--- lucene/dev/branches/branch_3x/solr/core/src/java/org/apache/solr/util/SolrPluginUtils.java
(original)
+++ lucene/dev/branches/branch_3x/solr/core/src/java/org/apache/solr/util/SolrPluginUtils.java
Thu Sep 15 22:43:33 2011
@@ -29,6 +29,7 @@ import org.apache.solr.common.params.App
 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;
@@ -1070,6 +1071,26 @@ 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);
+  }
 }
 
 



Mime
View raw message