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 0f85feb13c9..0f46725eb27 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,26 +69,19 @@ public class CloudMLTQParser extends QParser { Map boostFields = new HashMap<>(); MoreLikeThis mlt = new MoreLikeThis(req.getSearcher().getIndexReader()); - if(localParams.getInt("mintf") != null) - mlt.setMinTermFreq(localParams.getInt("mintf")); + mlt.setMinTermFreq(localParams.getInt("mintf", MoreLikeThis.DEFAULT_MIN_TERM_FREQ)); mlt.setMinDocFreq(localParams.getInt("mindf", 0)); - if(localParams.get("minwl") != null) - mlt.setMinWordLen(localParams.getInt("minwl")); + mlt.setMinWordLen(localParams.getInt("minwl", MoreLikeThis.DEFAULT_MIN_WORD_LENGTH)); - if(localParams.get("maxwl") != null) - mlt.setMaxWordLen(localParams.getInt("maxwl")); + mlt.setMaxWordLen(localParams.getInt("maxwl", MoreLikeThis.DEFAULT_MAX_WORD_LENGTH)); - if(localParams.get("maxqt") != null) - mlt.setMaxQueryTerms(localParams.getInt("maxqt")); + mlt.setMaxQueryTerms(localParams.getInt("maxqt", MoreLikeThis.DEFAULT_MAX_QUERY_TERMS)); - if(localParams.get("maxntp") != null) - mlt.setMaxNumTokensParsed(localParams.getInt("maxntp")); + mlt.setMaxNumTokensParsed(localParams.getInt("maxntp", MoreLikeThis.DEFAULT_MAX_NUM_TOKENS_PARSED)); - if(localParams.get("maxdf") != null) { - mlt.setMaxDocFreq(localParams.getInt("maxdf")); - } + mlt.setMaxDocFreq(localParams.getInt("maxdf", MoreLikeThis.DEFAULT_MAX_DOC_FREQ)); if(localParams.get("boost") != null) { mlt.setBoost(localParams.getBool("boost"));