You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by no...@apache.org on 2016/10/21 13:55:31 UTC

[1/3] lucene-solr:branch_6x: SOLR-9546: Eliminate unnecessary boxing/unboxing going on in SolrParams

Repository: lucene-solr
Updated Branches:
  refs/heads/branch_6x 3ce7552aa -> fd2dd537d


SOLR-9546: Eliminate unnecessary boxing/unboxing going on in SolrParams


Project: http://git-wip-us.apache.org/repos/asf/lucene-solr/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucene-solr/commit/f5134099
Tree: http://git-wip-us.apache.org/repos/asf/lucene-solr/tree/f5134099
Diff: http://git-wip-us.apache.org/repos/asf/lucene-solr/diff/f5134099

Branch: refs/heads/branch_6x
Commit: f51340993aea7cca3053844284c115bddaa90215
Parents: a08a2a2
Author: Noble Paul <no...@apache.org>
Authored: Fri Oct 21 18:58:33 2016 +0530
Committer: Noble Paul <no...@apache.org>
Committed: Fri Oct 21 19:17:17 2016 +0530

----------------------------------------------------------------------
 solr/CHANGES.txt                                |   2 +
 .../org/apache/solr/cloud/ZkController.java     |   2 +-
 .../apache/solr/handler/DumpRequestHandler.java |   6 +-
 .../apache/solr/handler/ReplicationHandler.java |   2 +-
 .../solr/response/BinaryResponseWriter.java     |   3 +-
 .../solr/response/JSONResponseWriter.java       |   3 +-
 .../apache/solr/search/HashQParserPlugin.java   |   4 +-
 .../TextLogisticRegressionQParserPlugin.java    |   2 +-
 .../apache/solr/search/mlt/CloudMLTQParser.java |  29 ++---
 .../solr/search/mlt/SimpleMLTQParser.java       |  33 ++---
 .../apache/solr/common/params/SolrParams.java   | 124 +++++++++++++++----
 11 files changed, 133 insertions(+), 77 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/f5134099/solr/CHANGES.txt
----------------------------------------------------------------------
diff --git a/solr/CHANGES.txt b/solr/CHANGES.txt
index 1b1c9cb..43384fe 100644
--- a/solr/CHANGES.txt
+++ b/solr/CHANGES.txt
@@ -184,6 +184,8 @@ Optimizations
 * SOLR-9566: Don't put replicas into recovery when first creating a Collection
   (Alan Woodward)
 
+* SOLR-9546: Eliminate unnecessary boxing/unboxing going on in SolrParams (Pushkar Raste, noble)
+
 Other Changes
 ----------------------
 

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/f5134099/solr/core/src/java/org/apache/solr/cloud/ZkController.java
----------------------------------------------------------------------
diff --git a/solr/core/src/java/org/apache/solr/cloud/ZkController.java b/solr/core/src/java/org/apache/solr/cloud/ZkController.java
index 9b0a90e..c0a8d55 100644
--- a/solr/core/src/java/org/apache/solr/cloud/ZkController.java
+++ b/solr/core/src/java/org/apache/solr/cloud/ZkController.java
@@ -1887,7 +1887,7 @@ public class ZkController {
         elect.setup(context);
         electionContexts.put(contextKey, context);
         
-        elect.retryElection(context, params.getBool(REJOIN_AT_HEAD_PROP));
+        elect.retryElection(context, params.getBool(REJOIN_AT_HEAD_PROP, false));
       }
     } catch (Exception e) {
       throw new SolrException(ErrorCode.SERVER_ERROR, "Unable to rejoin election", e);

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/f5134099/solr/core/src/java/org/apache/solr/handler/DumpRequestHandler.java
----------------------------------------------------------------------
diff --git a/solr/core/src/java/org/apache/solr/handler/DumpRequestHandler.java b/solr/core/src/java/org/apache/solr/handler/DumpRequestHandler.java
index 9b0f959..ecafb52 100644
--- a/solr/core/src/java/org/apache/solr/handler/DumpRequestHandler.java
+++ b/solr/core/src/java/org/apache/solr/handler/DumpRequestHandler.java
@@ -56,13 +56,15 @@ public class DumpRequestHandler extends RequestHandlerBase
       }
     }
 
-    if(Boolean.TRUE.equals( req.getParams().getBool("getdefaults"))){
+    if(req.getParams().getBool("getdefaults", false)){
       NamedList def = (NamedList) initArgs.get(PluginInfo.DEFAULTS);
       rsp.add("getdefaults", def);
     }
 
 
-    if(Boolean.TRUE.equals( req.getParams().getBool("initArgs"))) rsp.add("initArgs", initArgs);
+    if(req.getParams().getBool("initArgs", false)) {
+      rsp.add("initArgs", initArgs);
+    }
         
     // Write the streams...
     if( req.getContentStreams() != null ) {

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/f5134099/solr/core/src/java/org/apache/solr/handler/ReplicationHandler.java
----------------------------------------------------------------------
diff --git a/solr/core/src/java/org/apache/solr/handler/ReplicationHandler.java b/solr/core/src/java/org/apache/solr/handler/ReplicationHandler.java
index 759b7c6..d56d527 100644
--- a/solr/core/src/java/org/apache/solr/handler/ReplicationHandler.java
+++ b/solr/core/src/java/org/apache/solr/handler/ReplicationHandler.java
@@ -1431,7 +1431,7 @@ public class ReplicationHandler extends RequestHandlerBase implements SolrCoreAw
       sLen = params.get(LEN);
       compress = params.get(COMPRESSION);
       useChecksum = params.getBool(CHECKSUM, false);
-      indexGen = params.getLong(GENERATION, null);
+      indexGen = params.getLong(GENERATION);
       if (useChecksum) {
         checksum = new Adler32();
       }

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/f5134099/solr/core/src/java/org/apache/solr/response/BinaryResponseWriter.java
----------------------------------------------------------------------
diff --git a/solr/core/src/java/org/apache/solr/response/BinaryResponseWriter.java b/solr/core/src/java/org/apache/solr/response/BinaryResponseWriter.java
index 9634e63..11c6074 100644
--- a/solr/core/src/java/org/apache/solr/response/BinaryResponseWriter.java
+++ b/solr/core/src/java/org/apache/solr/response/BinaryResponseWriter.java
@@ -47,8 +47,7 @@ public class BinaryResponseWriter implements BinaryQueryResponseWriter {
   @Override
   public void write(OutputStream out, SolrQueryRequest req, SolrQueryResponse response) throws IOException {
     Resolver resolver = new Resolver(req, response.getReturnFields());
-    Boolean omitHeader = req.getParams().getBool(CommonParams.OMIT_HEADER);
-    if (omitHeader != null && omitHeader) response.removeResponseHeader();
+    if (req.getParams().getBool(CommonParams.OMIT_HEADER, false)) response.removeResponseHeader();
     new JavaBinCodec(resolver).setWritableDocFields(resolver).marshal(response.getValues(), out);
   }
 

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/f5134099/solr/core/src/java/org/apache/solr/response/JSONResponseWriter.java
----------------------------------------------------------------------
diff --git a/solr/core/src/java/org/apache/solr/response/JSONResponseWriter.java b/solr/core/src/java/org/apache/solr/response/JSONResponseWriter.java
index 522030f..cd6648b 100644
--- a/solr/core/src/java/org/apache/solr/response/JSONResponseWriter.java
+++ b/solr/core/src/java/org/apache/solr/response/JSONResponseWriter.java
@@ -92,8 +92,7 @@ class JSONWriter extends TextResponseWriter {
     if(wrapperFunction!=null) {
         writer.write(wrapperFunction + "(");
     }
-    Boolean omitHeader = req.getParams().getBool(CommonParams.OMIT_HEADER);
-    if(omitHeader != null && omitHeader) rsp.removeResponseHeader();
+    if(req.getParams().getBool(CommonParams.OMIT_HEADER, false)) rsp.removeResponseHeader();
     writeNamedList(null, rsp.getValues());
     if(wrapperFunction!=null) {
         writer.write(')');

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/f5134099/solr/core/src/java/org/apache/solr/search/HashQParserPlugin.java
----------------------------------------------------------------------
diff --git a/solr/core/src/java/org/apache/solr/search/HashQParserPlugin.java b/solr/core/src/java/org/apache/solr/search/HashQParserPlugin.java
index 2112c71..db0223a 100644
--- a/solr/core/src/java/org/apache/solr/search/HashQParserPlugin.java
+++ b/solr/core/src/java/org/apache/solr/search/HashQParserPlugin.java
@@ -66,8 +66,8 @@ public class HashQParserPlugin extends QParserPlugin {
     }
 
     public Query parse() {
-      int workers = localParams.getInt("workers");
-      int worker = localParams.getInt("worker");
+      int workers = localParams.getInt("workers", 0);
+      int worker = localParams.getInt("worker", 0);
       String keys = params.get("partitionKeys");
       keys = keys.replace(" ", "");
       return new HashQuery(keys, workers, worker);

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/f5134099/solr/core/src/java/org/apache/solr/search/TextLogisticRegressionQParserPlugin.java
----------------------------------------------------------------------
diff --git a/solr/core/src/java/org/apache/solr/search/TextLogisticRegressionQParserPlugin.java b/solr/core/src/java/org/apache/solr/search/TextLogisticRegressionQParserPlugin.java
index 0ca9f72..2b316ca 100644
--- a/solr/core/src/java/org/apache/solr/search/TextLogisticRegressionQParserPlugin.java
+++ b/solr/core/src/java/org/apache/solr/search/TextLogisticRegressionQParserPlugin.java
@@ -74,7 +74,7 @@ public class TextLogisticRegressionQParserPlugin extends QParserPlugin {
       String[] terms = params.get("terms").split(",");
       String ws = params.get("weights");
       String dfsStr = params.get("idfs");
-      int iteration = params.getInt("iteration");
+      int iteration = params.getInt("iteration", 0);
       String outcome = params.get("outcome");
       int positiveLabel = params.getInt("positiveLabel", 1);
       double threshold = params.getDouble("threshold", 0.5);

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/f5134099/solr/core/src/java/org/apache/solr/search/mlt/CloudMLTQParser.java
----------------------------------------------------------------------
diff --git a/solr/core/src/java/org/apache/solr/search/mlt/CloudMLTQParser.java b/solr/core/src/java/org/apache/solr/search/mlt/CloudMLTQParser.java
index 7491653..2a64527 100644
--- a/solr/core/src/java/org/apache/solr/search/mlt/CloudMLTQParser.java
+++ b/solr/core/src/java/org/apache/solr/search/mlt/CloudMLTQParser.java
@@ -69,29 +69,16 @@ public class CloudMLTQParser extends QParser {
     Map<String,Float> boostFields = new HashMap<>();
     MoreLikeThis mlt = new MoreLikeThis(req.getSearcher().getIndexReader());
     
-    if(localParams.getInt("mintf") != null)
-      mlt.setMinTermFreq(localParams.getInt("mintf"));
-
-    mlt.setMinDocFreq(localParams.getInt("mindf", 0));
-
-    if(localParams.get("minwl") != null)
-      mlt.setMinWordLen(localParams.getInt("minwl"));
-
-    if(localParams.get("maxwl") != null)
-      mlt.setMaxWordLen(localParams.getInt("maxwl"));
-
-    if(localParams.get("maxqt") != null)
-      mlt.setMaxQueryTerms(localParams.getInt("maxqt"));
-
-    if(localParams.get("maxntp") != null)
-      mlt.setMaxNumTokensParsed(localParams.getInt("maxntp"));
-    
-    if(localParams.get("maxdf") != null) {
-      mlt.setMaxDocFreq(localParams.getInt("maxdf"));
-    }
+    mlt.setMinTermFreq(localParams.getInt("mintf", MoreLikeThis.DEFAULT_MIN_TERM_FREQ));
+    mlt.setMinDocFreq(localParams.getInt("mindf", MoreLikeThis.DEFAULT_MIN_DOC_FREQ));
+    mlt.setMinWordLen(localParams.getInt("minwl", MoreLikeThis.DEFAULT_MIN_WORD_LENGTH));
+    mlt.setMaxWordLen(localParams.getInt("maxwl", MoreLikeThis.DEFAULT_MIN_WORD_LENGTH));
+    mlt.setMaxQueryTerms(localParams.getInt("maxqt",MoreLikeThis.DEFAULT_MAX_QUERY_TERMS));
+    mlt.setMaxNumTokensParsed(localParams.getInt("maxntp",MoreLikeThis.DEFAULT_MAX_NUM_TOKENS_PARSED));
+    mlt.setMaxDocFreq(localParams.getInt("maxdf", MoreLikeThis.DEFAULT_MAX_DOC_FREQ));
 
     if(localParams.get("boost") != null) {
-      mlt.setBoost(localParams.getBool("boost"));
+      mlt.setBoost(localParams.getBool("boost", false));
       boostFields = SolrPluginUtils.parseFieldBoosts(qf);
     }
 

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/f5134099/solr/core/src/java/org/apache/solr/search/mlt/SimpleMLTQParser.java
----------------------------------------------------------------------
diff --git a/solr/core/src/java/org/apache/solr/search/mlt/SimpleMLTQParser.java b/solr/core/src/java/org/apache/solr/search/mlt/SimpleMLTQParser.java
index bdcaafb..d4403ad 100644
--- a/solr/core/src/java/org/apache/solr/search/mlt/SimpleMLTQParser.java
+++ b/solr/core/src/java/org/apache/solr/search/mlt/SimpleMLTQParser.java
@@ -69,30 +69,17 @@ public class SimpleMLTQParser extends QParser {
       ScoreDoc[] scoreDocs = td.scoreDocs;
       MoreLikeThis mlt = new MoreLikeThis(req.getSearcher().getIndexReader());
       
-      if(localParams.getInt("mintf") != null)
-        mlt.setMinTermFreq(localParams.getInt("mintf"));
-      
-      if(localParams.getInt("mindf") != null)
-      mlt.setMinDocFreq(localParams.getInt("mindf"));
-      
-      if(localParams.get("minwl") != null)
-        mlt.setMinWordLen(localParams.getInt("minwl"));
-
-      if(localParams.get("maxwl") != null)
-        mlt.setMaxWordLen(localParams.getInt("maxwl"));
-
-      if(localParams.get("maxqt") != null)
-        mlt.setMaxQueryTerms(localParams.getInt("maxqt"));
-
-      if(localParams.get("maxntp") != null)
-        mlt.setMaxNumTokensParsed(localParams.getInt("maxntp"));
-
-      if(localParams.get("maxdf") != null) {
-        mlt.setMaxDocFreq(localParams.getInt("maxdf"));
-      }
-
+      mlt.setMinTermFreq(localParams.getInt("mintf", MoreLikeThis.DEFAULT_MIN_TERM_FREQ));
+      mlt.setMinDocFreq(localParams.getInt("mindf", MoreLikeThis.DEFAULT_MIN_DOC_FREQ));
+      mlt.setMinWordLen(localParams.getInt("minwl", MoreLikeThis.DEFAULT_MIN_WORD_LENGTH));
+      mlt.setMaxWordLen(localParams.getInt("maxwl", MoreLikeThis.DEFAULT_MAX_WORD_LENGTH));
+      mlt.setMaxQueryTerms(localParams.getInt("maxqt", MoreLikeThis.DEFAULT_MAX_QUERY_TERMS));
+      mlt.setMaxNumTokensParsed(localParams.getInt("maxntp", MoreLikeThis.DEFAULT_MAX_NUM_TOKENS_PARSED));
+      mlt.setMaxDocFreq(localParams.getInt("maxdf", MoreLikeThis.DEFAULT_MAX_DOC_FREQ));
+
+      // what happens if value is explicitly set to false?
       if(localParams.get("boost") != null) {
-        mlt.setBoost(localParams.getBool("boost"));
+        mlt.setBoost(localParams.getBool("boost", false));
         boostFields = SolrPluginUtils.parseFieldBoosts(qf);
       }
       

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/f5134099/solr/solrj/src/java/org/apache/solr/common/params/SolrParams.java
----------------------------------------------------------------------
diff --git a/solr/solrj/src/java/org/apache/solr/common/params/SolrParams.java b/solr/solrj/src/java/org/apache/solr/common/params/SolrParams.java
index 0b74c14..e884a5b 100644
--- a/solr/solrj/src/java/org/apache/solr/common/params/SolrParams.java
+++ b/solr/solrj/src/java/org/apache/solr/common/params/SolrParams.java
@@ -92,11 +92,24 @@ public abstract class SolrParams implements Serializable, MapSerializable {
     return val!=null ? val : getParams(param);
   }
 
-  /** Returns the Boolean value of the param, or null if not set */
+  /** 
+   * Returns the Boolean value of the param, or null if not set. 
+   * Use this method only when you want to be explicit 
+   * about absence of a value (<code>null</code>) vs the default value <code>false</code>.  
+   * @see #getBool(String, boolean) 
+   * @see #getPrimitiveBool(String) 
+   *  
+   **/
+  
   public Boolean getBool(String param) {
     String val = get(param);
     return val==null ? null : StrUtils.parseBool(val);
   }
+  
+  /** Returns the boolean value of the param, or <code>false</code> if not set */
+  public boolean getPrimitiveBool(String param) {
+    return getBool(param, false);
+  }
 
   /** Returns the boolean value of the param, or def if not set */
   public boolean getBool(String param, boolean def) {
@@ -104,21 +117,46 @@ public abstract class SolrParams implements Serializable, MapSerializable {
     return val==null ? def : StrUtils.parseBool(val);
   }
 
-  /** Returns the Boolean value of the field param,
-      or the value for param, or null if neither is set. */
+  /** 
+   * Returns the Boolean value of the field param,
+   * or the value for param, or null if neither is set. 
+   * Use this method only when you want to be explicit 
+   * about absence of a value (<code>null</code>) vs the default value <code>false</code>.  
+   * @see #getFieldBool(String, String, boolean) 
+   * @see #getPrimitiveFieldBool(String, String)    
+   **/
   public Boolean getFieldBool(String field, String param) {
     String val = getFieldParam(field, param);
     return val==null ? null : StrUtils.parseBool(val);
   }
+  
+  /**
+   * Returns the boolean value of the field param, or
+   * the value for param or 
+   * the default value of boolean - <code>false</code> 
+   */
+  public boolean getPrimitiveFieldBool(String field, String param) {
+    return getFieldBool(field, param, false);
+  }
 
-  /** Returns the boolean value of the field param,
-  or the value for param, or def if neither is set. */
+  /** 
+   * Returns the boolean value of the field param,
+   * or the value for param, or def if neither is set. 
+   * 
+   * */
   public boolean getFieldBool(String field, String param, boolean def) {
     String val = getFieldParam(field, param);
     return val==null ? def : StrUtils.parseBool(val);
   }
 
-  /** Returns the Integer value of the param, or null if not set */
+  /** 
+   * Returns the Integer value of the param, or null if not set 
+   * Use this method only when you want to be explicit 
+   * about absence of a value (<code>null</code>) vs the default value for int -
+   * zero (<code>0</code>).  
+   * @see #getInt(String, int) 
+   * @see #getPrimitiveInt(String) 
+   * */
   public Integer getInt(String param) {
     String val = get(param);
     try {
@@ -128,30 +166,33 @@ public abstract class SolrParams implements Serializable, MapSerializable {
       throw new SolrException( SolrException.ErrorCode.BAD_REQUEST, ex.getMessage(), ex );
     }
   }
-
-  /** Returns the Long value of the param, or null if not set */
-  public Long getLong(String param, Long def) {
-    String val = get(param);
-    try {
-      return val== null ? def : Long.parseLong(val);
-    }
-    catch( Exception ex ) {
-      throw new SolrException( SolrException.ErrorCode.BAD_REQUEST, ex.getMessage(), ex );
-    }
+  
+  /**
+   * Returns int value of the the param or 
+   * default value for int - zero (<code>0</code>) if not set. 
+   */
+  public int getPrimitiveInt(String param) {
+    return getInt(param, 0);
   }
 
   /** Returns the int value of the param, or def if not set */
   public int getInt(String param, int def) {
     String val = get(param);
     try {
-      return val==null ? def : Integer.parseInt(val);
+      return val == null ? def : Integer.parseInt(val);
     }
     catch( Exception ex ) {
       throw new SolrException( SolrException.ErrorCode.BAD_REQUEST, ex.getMessage(), ex );
     }
   }
 
-  /** Returns the Long value of the param, or null if not set */
+  /** 
+   * Returns the Long value of the param, or null if not set 
+   * Use this method only when you want to be explicit 
+   * about absence of a value (<code>null</code>) vs the default value zero (<code>0</code>).  
+   * @see #getLong(String, long) 
+   *
+   **/
   public Long getLong(String param) {
     String val = get(param);
     try {
@@ -173,8 +214,13 @@ public abstract class SolrParams implements Serializable, MapSerializable {
 
 
   /**
+   * Use this method only when you want to be explicit 
+   * about absence of a value (<code>null</code>) vs the default value zero (<code>0</code>).
+   * 
    * @return The int value of the field param, or the value for param
    * or <code>null</code> if neither is set.
+   *   
+   * @see #getFieldInt(String, String, int) 
    **/
   public Integer getFieldInt(String field, String param) {
     String val = getFieldParam(field, param);
@@ -199,7 +245,12 @@ public abstract class SolrParams implements Serializable, MapSerializable {
   }
 
 
-  /** Returns the Float value of the param, or null if not set */
+  /** 
+   * Returns the Float value of the param, or null if not set 
+   * Use this method only when you want to be explicit 
+   * about absence of a value (<code>null</code>) vs the default value zero (<code>0.0f</code>).
+   * @see #getFloat(String, float)
+   **/
   public Float getFloat(String param) {
     String val = get(param);
     try {
@@ -221,7 +272,13 @@ public abstract class SolrParams implements Serializable, MapSerializable {
     }
   }
 
-  /** Returns the Float value of the param, or null if not set */
+  /** 
+   * Returns the Float value of the param, or null if not set 
+   * Use this method only when you want to be explicit 
+   * about absence of a value (<code>null</code>) vs the default value zero (<code>0.0d</code>).
+   * @see #getDouble(String, double)
+   *
+   **/
   public Double getDouble(String param) {
     String val = get(param);
     try {
@@ -244,7 +301,15 @@ public abstract class SolrParams implements Serializable, MapSerializable {
   }
 
 
-  /** Returns the float value of the field param. */
+  /** 
+   * Returns the float value of the field param. 
+   * Use this method only when you want to be explicit 
+   * about absence of a value (<code>null</code>) vs the default value zero (<code>0.0f</code>).
+   * 
+   * @see #getFieldFloat(String, String, float)
+   * @see #getPrimitiveFieldFloat(String, String)
+   * 
+   **/
   public Float getFieldFloat(String field, String param) {
     String val = getFieldParam(field, param);
     try {
@@ -254,6 +319,15 @@ public abstract class SolrParams implements Serializable, MapSerializable {
       throw new SolrException( SolrException.ErrorCode.BAD_REQUEST, ex.getMessage(), ex );
     }
   }
+  
+  /**
+   * Returns the float value of the field param or
+   * the value for param or 
+   * the default value for float - zero (<code>0.0f</code>)   
+   */
+  public float getPrimitiveFieldFloat(String field, String param) {
+    return getFieldFloat(field, param, 0.0f);
+  }
 
   /** Returns the float value of the field param,
   or the value for param, or def if neither is set. */
@@ -267,7 +341,13 @@ public abstract class SolrParams implements Serializable, MapSerializable {
     }
   }
 
-  /** Returns the float value of the field param. */
+  /** 
+   * Returns the float value of the field param. 
+   * Use this method only when you want to be explicit 
+   * about absence of a value (<code>null</code>) vs the default value zero (<code>0.0d</code>).
+   * @see #getDouble(String, double)
+   *
+   **/
   public Double getFieldDouble(String field, String param) {
     String val = getFieldParam(field, param);
     try {


[3/3] lucene-solr:branch_6x: Merge remote-tracking branch 'origin/branch_6x' into branch_6x

Posted by no...@apache.org.
Merge remote-tracking branch 'origin/branch_6x' into branch_6x


Project: http://git-wip-us.apache.org/repos/asf/lucene-solr/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucene-solr/commit/fd2dd537
Tree: http://git-wip-us.apache.org/repos/asf/lucene-solr/tree/fd2dd537
Diff: http://git-wip-us.apache.org/repos/asf/lucene-solr/diff/fd2dd537

Branch: refs/heads/branch_6x
Commit: fd2dd537d9235aad59cbd6219d05bdc8390bc970
Parents: 7131849 3ce7552
Author: Noble Paul <no...@apache.org>
Authored: Fri Oct 21 19:25:19 2016 +0530
Committer: Noble Paul <no...@apache.org>
Committed: Fri Oct 21 19:25:19 2016 +0530

----------------------------------------------------------------------
 .../util/RunListenerPrintReproduceInfo.java     |   4 +-
 .../util/TestRuleSetupAndRestoreClassEnv.java   |  13 +-
 solr/CHANGES.txt                                |   3 +
 .../java/org/apache/solr/cloud/BackupCmd.java   |  75 ++++-
 .../apache/solr/cloud/CreateSnapshotCmd.java    | 179 ++++++++++++
 .../apache/solr/cloud/DeleteSnapshotCmd.java    | 160 +++++++++++
 .../cloud/OverseerCollectionMessageHandler.java |   2 +
 .../snapshots/CollectionSnapshotMetaData.java   | 242 ++++++++++++++++
 .../core/snapshots/SolrSnapshotManager.java     | 180 ++++++++++++
 .../solr/handler/admin/CollectionsHandler.java  |  54 +++-
 .../solr/handler/admin/CoreAdminOperation.java  |   7 +-
 .../solr/handler/admin/CreateSnapshotOp.java    |  10 +-
 .../solr/handler/admin/DeleteSnapshotOp.java    |   4 +
 .../core/snapshots/TestSolrCloudSnapshots.java  | 285 +++++++++++++++++++
 .../solrj/request/CollectionAdminRequest.java   | 116 +++++++-
 .../solr/common/params/CollectionParams.java    |   3 +
 16 files changed, 1322 insertions(+), 15 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/fd2dd537/solr/CHANGES.txt
----------------------------------------------------------------------


[2/3] lucene-solr:branch_6x: SOLR-9546: reverted some changes

Posted by no...@apache.org.
SOLR-9546: reverted some changes


Project: http://git-wip-us.apache.org/repos/asf/lucene-solr/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucene-solr/commit/71318498
Tree: http://git-wip-us.apache.org/repos/asf/lucene-solr/tree/71318498
Diff: http://git-wip-us.apache.org/repos/asf/lucene-solr/diff/71318498

Branch: refs/heads/branch_6x
Commit: 7131849892f07ae9ad5cb945a138078e94fcb919
Parents: f513409
Author: Noble Paul <no...@apache.org>
Authored: Fri Oct 21 19:16:15 2016 +0530
Committer: Noble Paul <no...@apache.org>
Committed: Fri Oct 21 19:17:28 2016 +0530

----------------------------------------------------------------------
 .../apache/solr/search/mlt/CloudMLTQParser.java | 29 ++++++++++++++------
 1 file changed, 21 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/71318498/solr/core/src/java/org/apache/solr/search/mlt/CloudMLTQParser.java
----------------------------------------------------------------------
diff --git a/solr/core/src/java/org/apache/solr/search/mlt/CloudMLTQParser.java b/solr/core/src/java/org/apache/solr/search/mlt/CloudMLTQParser.java
index 2a64527..7491653 100644
--- a/solr/core/src/java/org/apache/solr/search/mlt/CloudMLTQParser.java
+++ b/solr/core/src/java/org/apache/solr/search/mlt/CloudMLTQParser.java
@@ -69,16 +69,29 @@ public class CloudMLTQParser extends QParser {
     Map<String,Float> boostFields = new HashMap<>();
     MoreLikeThis mlt = new MoreLikeThis(req.getSearcher().getIndexReader());
     
-    mlt.setMinTermFreq(localParams.getInt("mintf", MoreLikeThis.DEFAULT_MIN_TERM_FREQ));
-    mlt.setMinDocFreq(localParams.getInt("mindf", MoreLikeThis.DEFAULT_MIN_DOC_FREQ));
-    mlt.setMinWordLen(localParams.getInt("minwl", MoreLikeThis.DEFAULT_MIN_WORD_LENGTH));
-    mlt.setMaxWordLen(localParams.getInt("maxwl", MoreLikeThis.DEFAULT_MIN_WORD_LENGTH));
-    mlt.setMaxQueryTerms(localParams.getInt("maxqt",MoreLikeThis.DEFAULT_MAX_QUERY_TERMS));
-    mlt.setMaxNumTokensParsed(localParams.getInt("maxntp",MoreLikeThis.DEFAULT_MAX_NUM_TOKENS_PARSED));
-    mlt.setMaxDocFreq(localParams.getInt("maxdf", MoreLikeThis.DEFAULT_MAX_DOC_FREQ));
+    if(localParams.getInt("mintf") != null)
+      mlt.setMinTermFreq(localParams.getInt("mintf"));
+
+    mlt.setMinDocFreq(localParams.getInt("mindf", 0));
+
+    if(localParams.get("minwl") != null)
+      mlt.setMinWordLen(localParams.getInt("minwl"));
+
+    if(localParams.get("maxwl") != null)
+      mlt.setMaxWordLen(localParams.getInt("maxwl"));
+
+    if(localParams.get("maxqt") != null)
+      mlt.setMaxQueryTerms(localParams.getInt("maxqt"));
+
+    if(localParams.get("maxntp") != null)
+      mlt.setMaxNumTokensParsed(localParams.getInt("maxntp"));
+    
+    if(localParams.get("maxdf") != null) {
+      mlt.setMaxDocFreq(localParams.getInt("maxdf"));
+    }
 
     if(localParams.get("boost") != null) {
-      mlt.setBoost(localParams.getBool("boost", false));
+      mlt.setBoost(localParams.getBool("boost"));
       boostFields = SolrPluginUtils.parseFieldBoosts(qf);
     }