mirror of https://github.com/apache/lucene.git
LUCENE-8221: MoreLikeThis.setMaxDocFreqPct can easily int-overflow on larger indexes.
This commit is contained in:
parent
41ecad9897
commit
719fce8026
|
@ -202,6 +202,9 @@ New Features
|
|||
|
||||
Bug Fixes
|
||||
|
||||
* LUCENE-8221: MoreLikeThis.setMaxDocFreqPct can easily int-overflow on larger
|
||||
indexes.
|
||||
|
||||
* LUCENE-8266: Detect bogus tiles when creating a standard polygon and
|
||||
throw a TileException. (Ignacio Vera)
|
||||
|
||||
|
|
|
@ -418,14 +418,16 @@ public final class MoreLikeThis {
|
|||
* Set the maximum percentage in which words may still appear. Words that appear
|
||||
* in more than this many percent of all docs will be ignored.
|
||||
*
|
||||
* This method calls {@link #setMaxDocFreq(int)} internally (both conditions cannot
|
||||
* be used at the same time).
|
||||
*
|
||||
* @param maxPercentage the maximum percentage of documents (0-100) that a term may appear
|
||||
* in to be still considered relevant
|
||||
* in to be still considered relevant.
|
||||
*/
|
||||
public void setMaxDocFreqPct(int maxPercentage) {
|
||||
this.maxDocFreq = maxPercentage * ir.numDocs() / 100;
|
||||
setMaxDocFreq(Math.toIntExact((long) maxPercentage * ir.numDocs() / 100));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns whether to boost terms in query based on "score" or not. The default is
|
||||
* {@link #DEFAULT_BOOST}.
|
||||
|
|
Loading…
Reference in New Issue