You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by dw...@apache.org on 2017/06/12 12:46:41 UTC

lucene-solr:branch_6x: SOLR-10849: MoreLikeThisComponent should expose setMaxDocFreqPct (maxDoc frequency percentage).

Repository: lucene-solr
Updated Branches:
  refs/heads/branch_6x d845bc9f2 -> 3adba360e


SOLR-10849: MoreLikeThisComponent should expose setMaxDocFreqPct (maxDoc frequency percentage).


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

Branch: refs/heads/branch_6x
Commit: 3adba360e3e7cf904058f2263a6379e69b17d6aa
Parents: d845bc9
Author: Dawid Weiss <dw...@apache.org>
Authored: Mon Jun 12 11:48:21 2017 +0200
Committer: Dawid Weiss <dw...@apache.org>
Committed: Mon Jun 12 14:46:33 2017 +0200

----------------------------------------------------------------------
 solr/CHANGES.txt                                              | 3 +++
 .../src/java/org/apache/solr/handler/MoreLikeThisHandler.java | 7 +++++++
 .../org/apache/solr/common/params/MoreLikeThisParams.java     | 1 +
 3 files changed, 11 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/3adba360/solr/CHANGES.txt
----------------------------------------------------------------------
diff --git a/solr/CHANGES.txt b/solr/CHANGES.txt
index d0a9298..8d94d29 100644
--- a/solr/CHANGES.txt
+++ b/solr/CHANGES.txt
@@ -44,6 +44,9 @@ Upgrade Notes
 New Features
 ----------------------
 
+* SOLR-10849: MoreLikeThisComponent should expose setMaxDocFreqPct (maxDoc 
+  frequency percentage). (Dawid Weiss)
+
 * SOLR-10307: Allow Passing SSL passwords through environment variables. (Mano Kovacs via Mark Miller)
 
 * SOLR-10721: Provide a way to know when Core Discovery is finished and when all async cores are done loading

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/3adba360/solr/core/src/java/org/apache/solr/handler/MoreLikeThisHandler.java
----------------------------------------------------------------------
diff --git a/solr/core/src/java/org/apache/solr/handler/MoreLikeThisHandler.java b/solr/core/src/java/org/apache/solr/handler/MoreLikeThisHandler.java
index 88b88c5..c6ba21d 100644
--- a/solr/core/src/java/org/apache/solr/handler/MoreLikeThisHandler.java
+++ b/solr/core/src/java/org/apache/solr/handler/MoreLikeThisHandler.java
@@ -337,6 +337,13 @@ public class MoreLikeThisHandler extends RequestHandlerBase
       mlt.setMaxQueryTerms(     params.getInt(MoreLikeThisParams.MAX_QUERY_TERMS,       MoreLikeThis.DEFAULT_MAX_QUERY_TERMS));
       mlt.setMaxNumTokensParsed(params.getInt(MoreLikeThisParams.MAX_NUM_TOKENS_PARSED, MoreLikeThis.DEFAULT_MAX_NUM_TOKENS_PARSED));
       mlt.setBoost(            params.getBool(MoreLikeThisParams.BOOST, false ) );
+      
+      // There is no default for maxDocFreqPct. Also, it's a bit oddly expressed as an integer value 
+      // (percentage of the collection's documents count). We keep Lucene's convention here. 
+      if (params.getInt(MoreLikeThisParams.MAX_DOC_FREQ_PCT) != null) {
+        mlt.setMaxDocFreqPct(params.getInt(MoreLikeThisParams.MAX_DOC_FREQ_PCT));
+      }
+
       boostFields = SolrPluginUtils.parseFieldBoosts(params.getParams(MoreLikeThisParams.QF));
     }
     

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/3adba360/solr/solrj/src/java/org/apache/solr/common/params/MoreLikeThisParams.java
----------------------------------------------------------------------
diff --git a/solr/solrj/src/java/org/apache/solr/common/params/MoreLikeThisParams.java b/solr/solrj/src/java/org/apache/solr/common/params/MoreLikeThisParams.java
index c898fdb..919f786 100644
--- a/solr/solrj/src/java/org/apache/solr/common/params/MoreLikeThisParams.java
+++ b/solr/solrj/src/java/org/apache/solr/common/params/MoreLikeThisParams.java
@@ -31,6 +31,7 @@ public interface MoreLikeThisParams
   public final static String SIMILARITY_FIELDS     = PREFIX + "fl";
   public final static String MIN_TERM_FREQ         = PREFIX + "mintf";
   public final static String MAX_DOC_FREQ          = PREFIX + "maxdf";
+  public final static String MAX_DOC_FREQ_PCT      = PREFIX + "maxdfpct";
   public final static String MIN_DOC_FREQ          = PREFIX + "mindf";
   public final static String MIN_WORD_LEN          = PREFIX + "minwl";
   public final static String MAX_WORD_LEN          = PREFIX + "maxwl";