mirror of https://github.com/apache/lucene.git
LUCENE-7383: Fix 'dimensionNumBytes' validation
This commit is contained in:
parent
85a585c516
commit
9b85f68278
|
@ -76,6 +76,9 @@ Bug Fixes
|
|||
wrong default AttributeFactory for new Tokenizers.
|
||||
(Terry Smith, Uwe Schindler)
|
||||
|
||||
* LUCENE-7389: Fix FieldType.setDimensions(...) validation for the dimensionNumBytes
|
||||
parameter. (Martijn van Groningen)
|
||||
|
||||
Improvements
|
||||
|
||||
* LUCENE-7323: Compound file writing now verifies the incoming
|
||||
|
|
|
@ -374,7 +374,7 @@ public class FieldType implements IndexableFieldType {
|
|||
if (dimensionNumBytes < 0) {
|
||||
throw new IllegalArgumentException("dimensionNumBytes must be >= 0; got " + dimensionNumBytes);
|
||||
}
|
||||
if (dimensionCount > PointValues.MAX_NUM_BYTES) {
|
||||
if (dimensionNumBytes > PointValues.MAX_NUM_BYTES) {
|
||||
throw new IllegalArgumentException("dimensionNumBytes must be <= " + PointValues.MAX_NUM_BYTES + "; got " + dimensionNumBytes);
|
||||
}
|
||||
if (dimensionCount == 0) {
|
||||
|
|
|
@ -362,9 +362,8 @@ public class TestPointValues extends LuceneTestCase {
|
|||
IndexWriterConfig iwc = new IndexWriterConfig(new MockAnalyzer(random()));
|
||||
IndexWriter w = new IndexWriter(dir, iwc);
|
||||
Document doc = new Document();
|
||||
doc.add(new BinaryPoint("dim", new byte[PointValues.MAX_NUM_BYTES+1]));
|
||||
expectThrows(IllegalArgumentException.class, () -> {
|
||||
w.addDocument(doc);
|
||||
doc.add(new BinaryPoint("dim", new byte[PointValues.MAX_NUM_BYTES+1]));
|
||||
});
|
||||
|
||||
Document doc2 = new Document();
|
||||
|
|
Loading…
Reference in New Issue