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

[11/35] lucene-solr:jira/SOLR-10834: SOLR-10849: MoreLikeThisComponent should expose setMaxDocFreqPct (maxDoc frequency percentage).

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/b2ea95c9
Tree: http://git-wip-us.apache.org/repos/asf/lucene-solr/tree/b2ea95c9
Diff: http://git-wip-us.apache.org/repos/asf/lucene-solr/diff/b2ea95c9

Branch: refs/heads/jira/SOLR-10834
Commit: b2ea95c9ecbf68c35ff485b0f16ed756a6105487
Parents: 661a3c4
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:44:06 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/b2ea95c9/solr/CHANGES.txt
----------------------------------------------------------------------
diff --git a/solr/CHANGES.txt b/solr/CHANGES.txt
index 9ba932f..e9a22db 100644
--- a/solr/CHANGES.txt
+++ b/solr/CHANGES.txt
@@ -284,6 +284,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/b2ea95c9/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 50ea711..0d12136 100644
--- a/solr/core/src/java/org/apache/solr/handler/MoreLikeThisHandler.java
+++ b/solr/core/src/java/org/apache/solr/handler/MoreLikeThisHandler.java
@@ -335,6 +335,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/b2ea95c9/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";