[
https://issues.apache.org/jira/browse/LUCENE-8221?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16414472#comment-16414472
]
Dawid Weiss commented on LUCENE-8221:
-------------------------------------
I tried to come up with the documentation of this method when maxDoc is used
and failed (this propagates to Solr's MLT handlers and docs too). I don't know
how to clearly convey what this method will actually calculate when maxDocs is
involved and at the same time I know what I want (previous behavior, with the
int-overflow gone).
I would like to sustain my request to commit this simple bug fix in and create
another issue for the change in behaviour you suggested, Robert. Or provide a
suggestion on the wording of the documentation for the maxDoc version. Thanks.
> MoreLikeThis.setMaxDocFreqPct can easily int-overflow on larger indexes
> -----------------------------------------------------------------------
>
> Key: LUCENE-8221
> URL: https://issues.apache.org/jira/browse/LUCENE-8221
> Project: Lucene - Core
> Issue Type: Bug
> Reporter: Dawid Weiss
> Assignee: Dawid Weiss
> Priority: Minor
> Attachments: LUCENE-8221.patch
>
>
> {code}
> public void setMaxDocFreqPct(int maxPercentage) {
> this.maxDocFreq = maxPercentage * ir.numDocs() / 100;
> }
> {code}
> The above overflows integer range into negative numbers on even fairly small
> indexes (for maxPercentage = 75, it happens for just over 28 million
> documents.
> We should make the computations on long range so that it doesn't overflow and
> have a more strict argument validation.
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]