apache / lucene

Apache Lucene open-source search software
https://lucene.apache.org/
Apache License 2.0
2.55k stars 1k forks source link

fix potential IndexOutOfBoundsException in *Classifier.getClasses(?,int) [LUCENE-8110] #9158

Open asfimport opened 6 years ago

asfimport commented 6 years ago

KNearestNeighborDocumentClassifier already has the one-line fix via SOLR-8871 and this ticket here is to add the same to the remaining Classifier classes.


Migrated from LUCENE-8110 by Christine Poerschke (@cpoerschke) Attachments: LUCENE-8110.patch

asfimport commented 6 years ago

ASF subversion and git services (migrated from JIRA)

Commit af41d02eae6a58fd450553f9a09c9325ddf6e0ab in lucene-solr's branch refs/heads/master from @cpoerschke https://git-wip-us.apache.org/repos/asf?p=lucene-solr.git;h=af41d02

LUCENE-8110: Fix potential IndexOutOfBoundsException in *Classifier.getClasses(?,int).

asfimport commented 6 years ago

ASF subversion and git services (migrated from JIRA)

Commit c73edb869a96bd6869da200944deb6d078cba283 in lucene-solr's branch refs/heads/branch_7x from @cpoerschke https://git-wip-us.apache.org/repos/asf?p=lucene-solr.git;h=c73edb8

LUCENE-8110: Fix potential IndexOutOfBoundsException in *Classifier.getClasses(?,int).

asfimport commented 6 years ago

Adrien Grand (@jpountz) (migrated from JIRA)

Should we add a test as well?

asfimport commented 6 years ago

Christine Poerschke (@cpoerschke) (migrated from JIRA)

Should we add a test as well?

Yes, that would be ideal. From what I vaguely recall, one way to encounter the exception is to index a document without an assigned class before there are any other documents or before there are documents with an assigned class. Or alternatively asking for multiple predicted classes when there is only one class assigned so far, something like that. I only stumbled across this and don't have bandwidth at the moment to work on a test or tests, so will revert for now then.

asfimport commented 6 years ago

ASF subversion and git services (migrated from JIRA)

Commit 6652d4fb00f2c50ca7f6f640977675557734e367 in lucene-solr's branch refs/heads/branch_7x from @cpoerschke https://git-wip-us.apache.org/repos/asf?p=lucene-solr.git;h=6652d4f

Revert "LUCENE-8110: Fix potential IndexOutOfBoundsException in *Classifier.getClasses(?,int)."

This reverts commit c73edb869a96bd6869da200944deb6d078cba283.

asfimport commented 6 years ago

ASF subversion and git services (migrated from JIRA)

Commit 152d223b3235459a30f6a8b1cb5331bec46dfb3d in lucene-solr's branch refs/heads/master from @cpoerschke https://git-wip-us.apache.org/repos/asf?p=lucene-solr.git;h=152d223

Revert "LUCENE-8110: Fix potential IndexOutOfBoundsException in *Classifier.getClasses(?,int)."

This reverts commit af41d02eae6a58fd450553f9a09c9325ddf6e0ab.

asfimport commented 6 years ago

Christine Poerschke (@cpoerschke) (migrated from JIRA)

Reverts complete. Another 'just noticed' thing, would it make sense to have more 'Component/s' choices e.g. classification and spatial on JIRA? A question for the dev-list that perhaps though rather than here.