Apache Lucene open-source search software
LUCENE-9149: Increase data dimension limit in BKD
Nicholas Knize206a70e7b790
diff --git a/lucene/CHANGES.txt b/lucene/CHANGES.txtindex 5b58d6c2a06..ee8a60d0e31 100644--- a/lucene/CHANGES.txt+++ b/lucene/CHANGES.txt@@ -116,6 +116,8 @@ New FeaturesImprovements---------------------+* LUCENE-9149: Increase data dimension limit in BKD. (Nick Knize)+* LUCENE-9102: Add maxQueryLength option to DirectSpellchecker. (Andy Webb via Bruno Roustant)* LUCENE-9091: UnifiedHighlighter HTML escaping should only escape essentials (Nándor Mátravölgyi)diff --git a/lucene/codecs/src/java/org/apache/lucene/codecs/simpletext/SimpleTextBKDReader.java b/lucene/codecs/src/java/org/apache/lucene/codecs/simpletext/SimpleTextBKDReader.javaindex 82879640f4b..8c0563c5c88 100644--- a/lucene/codecs/src/java/org/apache/lucene/codecs/simpletext/SimpleTextBKDReader.java+++ b/lucene/codecs/src/java/org/apache/lucene/codecs/simpletext/SimpleTextBKDReader.java@@ -40,7 +40,7 @@ final class SimpleTextBKDReader extends PointValues implements Accountable {final private byte[] splitPackedValues;final long[] leafBlockFPs;final private int leafNodeOffset;- final int numDataDims;+ final int numDims;final int numIndexDims;final int bytesPerDim;final int bytesPerIndexEntry;@@ -54,16 +54,16 @@ final class SimpleTextBKDReader extends PointValues implements Accountable {protected final int packedBytesLength;protected final int packedIndexBytesLength;- public SimpleTextBKDReader(IndexInput in, int numDataDims, int numIndexDims, int maxPointsInLeafNode, int bytesPerDim, long[] leafBlockFPs, byte[] splitPackedValues,+ public SimpleTextBKDReader(IndexInput in, int numDims, int numIndexDims, int maxPointsInLeafNode, int bytesPerDim, long[] leafBlockFPs, byte[] splitPackedValues,byte[] minPackedValue, byte[] maxPackedValue, long pointCount, int docCount) throws IOException {this.in = in;- this.numDataDims = numDataDims;+ this.numDims = numDims;this.numIndexDims = numIndexDims;this.maxPointsInLeafNode = maxPointsInLeafNode;this.bytesPerDim = bytesPerDim;// no version check here because callers of this API (SimpleText) have no back compat:bytesPerIndexEntry = numIndexDims == 1 ? bytesPerDim : bytesPerDim + 1;- packedBytesLength = numDataDims * bytesPerDim;+ packedBytesLength = numDims * bytesPerDim;packedIndexBytesLength = numIndexDims * bytesPerDim;this.leafNodeOffset = leafBlockFPs.length;this.leafBlockFPs = leafBlockFPs;@@ -118,7 +118,7 @@ final class SimpleTextBKDReader extends PointValues implements Accountable {/** Create a new {@link IntersectState} */public IntersectState getIntersectState(IntersectVisitor visitor) {- return new IntersectState(in.clone(), numDataDims,+ return new IntersectState(in.clone(), numDims,packedBytesLength,maxPointsInLeafNode,visitor);@@ -184,7 +184,7 @@ final class SimpleTextBKDReader extends PointValues implements Accountable {scratchPackedValue[compressedByteOffset] = in.readByte();final int runLen = Byte.toUnsignedInt(in.readByte());for (int j = 0; j < runLen; ++j) {- for(int dim=0;dim<numDataDims;dim++) {+ for(int dim = 0; dim< numDims; dim++) {int prefix = commonPrefixLengths[dim];in.readBytes(scratchPackedValue, dim*bytesPerDim + prefix, bytesPerDim - prefix);}@@ -206,7 +206,7 @@ final class SimpleTextBKDReader extends PointValues implements Accountable {}private void readCommonPrefixes(int[] commonPrefixLengths, byte[] scratchPackedValue, IndexInput in) throws IOException {- for(int dim=0;dim<numDataDims;dim++) {+ for(int dim = 0; dim< numDims; dim++) {int prefix = in.readVInt();commonPrefixLengths[dim] = prefix;if (prefix > 0) {@@ -370,8 +370,8 @@ final class SimpleTextBKDReader extends PointValues implements Accountable {}@Override- public int getNumDataDimensions() {- return numDataDims;+ public int getNumDimensions() {+ return numDims;}@Overridediff --git a/lucene/codecs/src/java/org/apache/lucene/codecs/simpletext/SimpleTextBKDWriter.java b/lucene/codecs/src/java/org/apache/lucene/codecs/simpletext/SimpleTextBKDWriter.javaindex ec41d874c94..dd8ca45c580 100644--- a/lucene/codecs/src/java/org/apache/lucene/codecs/simpletext/SimpleTextBKDWriter.java+++ b/lucene/codecs/src/java/org/apache/lucene/codecs/simpletext/SimpleTextBKDWriter.java@@ -95,8 +95,11 @@ final class SimpleTextBKDWriter implements Closeable {/** Default maximum heap to use, before spilling to (slower) disk */public static final float DEFAULT_MAX_MB_SORT_IN_HEAP = 16.0f;+ /** Maximum number of dimensions (2 * max index dimensions) */+ public static final int MAX_DIMS = 16;+/** Maximum number of dimensions */- public static final int MAX_DIMS = 8;+ public static final int MAX_INDEX_DIMS = 8;/** How many dimensions we are storing at the leaf (data) nodes */protected final int numDataDims;@@ -107,7 +110,7 @@ final class SimpleTextBKDWriter implements Closeable {/** How many bytes each value in each dimension takes. */protected final int bytesPerDim;- /** numDataDims * bytesPerDim */+ /** numDims * bytesPerDim */protected final int packedBytesLength;/** numIndexDims * bytesPerDim */@@ -188,14 +191,17 @@ final class SimpleTextBKDWriter implements Closeable {this.maxMBSortInHeap = maxMBSortInHeap;}- public static void verifyParams(int numDataDims, int numIndexDims, int maxPointsInLeafNode, double maxMBSortInHeap, long totalPointCount) {+ public static void verifyParams(int numDims, int numIndexDims, int maxPointsInLeafNode, double maxMBSortInHeap, long totalPointCount) {// We encode dim in a single byte in the splitPackedValues, but we only expose 4 bits for it now, in case we want to use// remaining 4 bits for another purpose later- if (numDataDims < 1 || numDataDims > MAX_DIMS) {- throw new IllegalArgumentException("numDataDims must be 1 .. " + MAX_DIMS + " (got: " + numDataDims + ")");+ if (numDims < 1 || numDims > MAX_DIMS) {+ throw new IllegalArgumentException("numDims must be 1 .. " + MAX_DIMS + " (got: " + numDims + ")");+ }+ if (numIndexDims < 1 || numIndexDims > MAX_INDEX_DIMS) {+ throw new IllegalArgumentException("numIndexDims must be 1 .. " + MAX_INDEX_DIMS + " (got: " + numIndexDims + ")");}- if (numIndexDims < 1 || numIndexDims > numDataDims) {- throw new IllegalArgumentException("numIndexDims must be 1 .. " + numDataDims + " (got: " + numIndexDims + ")");+ if (numIndexDims > numDims) {+ throw new IllegalArgumentException("numIndexDims cannot exceed numDims (" + numDims + ") (got: " + numIndexDims + ")");}if (maxPointsInLeafNode <= 0) {throw new IllegalArgumentException("maxPointsInLeafNode must be > 0; got " + maxPointsInLeafNode);diff --git a/lucene/codecs/src/java/org/apache/lucene/codecs/simpletext/SimpleTextFieldInfosFormat.java b/lucene/codecs/src/java/org/apache/lucene/codecs/simpletext/SimpleTextFieldInfosFormat.javaindex f52a84a4eb8..8d178130a91 100644--- a/lucene/codecs/src/java/org/apache/lucene/codecs/simpletext/SimpleTextFieldInfosFormat.java+++ b/lucene/codecs/src/java/org/apache/lucene/codecs/simpletext/SimpleTextFieldInfosFormat.java@@ -136,7 +136,7 @@ public class SimpleTextFieldInfosFormat extends FieldInfosFormat {SimpleTextUtil.readLine(input, scratch);assert StringHelper.startsWith(scratch.get(), DATA_DIM_COUNT);- int dataDimensionalCount = Integer.parseInt(readString(DATA_DIM_COUNT.length, scratch));+ int dimensionalCount = Integer.parseInt(readString(DATA_DIM_COUNT.length, scratch));SimpleTextUtil.readLine(input, scratch);assert StringHelper.startsWith(scratch.get(), INDEX_DIM_COUNT);@@ -152,7 +152,7 @@ public class SimpleTextFieldInfosFormat extends FieldInfosFormat {infos[i] = new FieldInfo(name, fieldNumber, storeTermVector,omitNorms, storePayloads, indexOptions, docValuesType, dvGen, Collections.unmodifiableMap(atts),- dataDimensionalCount, indexDimensionalCount, dimensionalNumBytes, isSoftDeletesField);+ dimensionalCount, indexDimensionalCount, dimensionalNumBytes, isSoftDeletesField);}SimpleTextUtil.checkFooter(input);@@ -242,7 +242,7 @@ public class SimpleTextFieldInfosFormat extends FieldInfosFormat {}SimpleTextUtil.write(out, DATA_DIM_COUNT);- SimpleTextUtil.write(out, Integer.toString(fi.getPointDataDimensionCount()), scratch);+ SimpleTextUtil.write(out, Integer.toString(fi.getPointDimensionCount()), scratch);SimpleTextUtil.writeNewline(out);SimpleTextUtil.write(out, INDEX_DIM_COUNT);diff --git a/lucene/codecs/src/java/org/apache/lucene/codecs/simpletext/SimpleTextPointsReader.java b/lucene/codecs/src/java/org/apache/lucene/codecs/simpletext/SimpleTextPointsReader.javaindex 728aad19873..3bc75f5f71b 100644--- a/lucene/codecs/src/java/org/apache/lucene/codecs/simpletext/SimpleTextPointsReader.java+++ b/lucene/codecs/src/java/org/apache/lucene/codecs/simpletext/SimpleTextPointsReader.java@@ -195,7 +195,7 @@ class SimpleTextPointsReader extends PointsReader {if (fieldInfo == null) {throw new IllegalArgumentException("field=\"" + fieldName + "\" is unrecognized");}- if (fieldInfo.getPointDataDimensionCount() == 0) {+ if (fieldInfo.getPointDimensionCount() == 0) {throw new IllegalArgumentException("field=\"" + fieldName + "\" did not index points");}return readers.get(fieldName);diff --git a/lucene/codecs/src/java/org/apache/lucene/codecs/simpletext/SimpleTextPointsWriter.java b/lucene/codecs/src/java/org/apache/lucene/codecs/simpletext/SimpleTextPointsWriter.javaindex b44da0c331a..cddbeb3402e 100644--- a/lucene/codecs/src/java/org/apache/lucene/codecs/simpletext/SimpleTextPointsWriter.java+++ b/lucene/codecs/src/java/org/apache/lucene/codecs/simpletext/SimpleTextPointsWriter.java@@ -76,7 +76,7 @@ class SimpleTextPointsWriter extends PointsWriter {try (SimpleTextBKDWriter writer = new SimpleTextBKDWriter(writeState.segmentInfo.maxDoc(),writeState.directory,writeState.segmentInfo.name,- fieldInfo.getPointDataDimensionCount(),+ fieldInfo.getPointDimensionCount(),fieldInfo.getPointIndexDimensionCount(),fieldInfo.getPointNumBytes(),SimpleTextBKDWriter.DEFAULT_MAX_POINTS_IN_LEAF_NODE,diff --git a/lucene/core/src/java/org/apache/lucene/codecs/PointsWriter.java b/lucene/core/src/java/org/apache/lucene/codecs/PointsWriter.javaindex dd1eaebc6c4..1f62c9fe524 100644--- a/lucene/core/src/java/org/apache/lucene/codecs/PointsWriter.java+++ b/lucene/core/src/java/org/apache/lucene/codecs/PointsWriter.java@@ -48,7 +48,7 @@ public abstract class PointsWriter implements Closeable {PointsReader pointsReader = mergeState.pointsReaders[i];if (pointsReader != null) {FieldInfo readerFieldInfo = mergeState.fieldInfos[i].fieldInfo(fieldInfo.name);- if (readerFieldInfo != null && readerFieldInfo.getPointDataDimensionCount() > 0) {+ if (readerFieldInfo != null && readerFieldInfo.getPointDimensionCount() > 0) {PointValues values = pointsReader.getValues(fieldInfo.name);if (values != null) {maxPointCount += values.size();@@ -92,7 +92,7 @@ public abstract class PointsWriter implements Closeable {continue;}- if (readerFieldInfo.getPointDataDimensionCount() == 0) {+ if (readerFieldInfo.getPointDimensionCount() == 0) {// This segment saw this field, but the field did not index points in it:continue;}@@ -143,7 +143,7 @@ public abstract class PointsWriter implements Closeable {}@Override- public int getNumDataDimensions() {+ public int getNumDimensions() {throw new UnsupportedOperationException();}@@ -187,7 +187,7 @@ public abstract class PointsWriter implements Closeable {}// merge field at a timefor (FieldInfo fieldInfo : mergeState.mergeFieldInfos) {- if (fieldInfo.getPointDataDimensionCount() != 0) {+ if (fieldInfo.getPointDimensionCount() != 0) {mergeOneField(mergeState, fieldInfo);}}diff --git a/lucene/core/src/java/org/apache/lucene/codecs/lucene60/Lucene60FieldInfosFormat.java b/lucene/core/src/java/org/apache/lucene/codecs/lucene60/Lucene60FieldInfosFormat.javaindex 3d7d25ac4de..6ab81cd04db 100644--- a/lucene/core/src/java/org/apache/lucene/codecs/lucene60/Lucene60FieldInfosFormat.java+++ b/lucene/core/src/java/org/apache/lucene/codecs/lucene60/Lucene60FieldInfosFormat.java@@ -291,8 +291,8 @@ public final class Lucene60FieldInfosFormat extends FieldInfosFormat {output.writeByte(docValuesByte(fi.getDocValuesType()));output.writeLong(fi.getDocValuesGen());output.writeMapOfStrings(fi.attributes());- output.writeVInt(fi.getPointDataDimensionCount());- if (fi.getPointDataDimensionCount() != 0) {+ output.writeVInt(fi.getPointDimensionCount());+ if (fi.getPointDimensionCount() != 0) {output.writeVInt(fi.getPointIndexDimensionCount());output.writeVInt(fi.getPointNumBytes());}diff --git a/lucene/core/src/java/org/apache/lucene/codecs/lucene60/Lucene60PointsReader.java b/lucene/core/src/java/org/apache/lucene/codecs/lucene60/Lucene60PointsReader.javaindex b5ff68063e6..0eecdbbce59 100644--- a/lucene/core/src/java/org/apache/lucene/codecs/lucene60/Lucene60PointsReader.java+++ b/lucene/core/src/java/org/apache/lucene/codecs/lucene60/Lucene60PointsReader.java@@ -124,7 +124,7 @@ public class Lucene60PointsReader extends PointsReader implements Closeable {if (fieldInfo == null) {throw new IllegalArgumentException("field=\"" + fieldName + "\" is unrecognized");}- if (fieldInfo.getPointDataDimensionCount() == 0) {+ if (fieldInfo.getPointDimensionCount() == 0) {throw new IllegalArgumentException("field=\"" + fieldName + "\" did not index point values");}diff --git a/lucene/core/src/java/org/apache/lucene/codecs/lucene60/Lucene60PointsWriter.java b/lucene/core/src/java/org/apache/lucene/codecs/lucene60/Lucene60PointsWriter.javaindex d9e63050cec..c73a9b18f59 100644--- a/lucene/core/src/java/org/apache/lucene/codecs/lucene60/Lucene60PointsWriter.java+++ b/lucene/core/src/java/org/apache/lucene/codecs/lucene60/Lucene60PointsWriter.java@@ -93,7 +93,7 @@ public class Lucene60PointsWriter extends PointsWriter implements Closeable {try (BKDWriter writer = new BKDWriter(writeState.segmentInfo.maxDoc(),writeState.directory,writeState.segmentInfo.name,- fieldInfo.getPointDataDimensionCount(),+ fieldInfo.getPointDimensionCount(),fieldInfo.getPointIndexDimensionCount(),fieldInfo.getPointNumBytes(),maxPointsInLeafNode,@@ -151,8 +151,8 @@ public class Lucene60PointsWriter extends PointsWriter implements Closeable {}for (FieldInfo fieldInfo : mergeState.mergeFieldInfos) {- if (fieldInfo.getPointDataDimensionCount() != 0) {- if (fieldInfo.getPointDataDimensionCount() == 1) {+ if (fieldInfo.getPointDimensionCount() != 0) {+ if (fieldInfo.getPointDimensionCount() == 1) {// Worst case total maximum size (if none of the points are deleted):long totMaxSize = 0;@@ -161,7 +161,7 @@ public class Lucene60PointsWriter extends PointsWriter implements Closeable {if (reader != null) {FieldInfos readerFieldInfos = mergeState.fieldInfos[i];FieldInfo readerFieldInfo = readerFieldInfos.fieldInfo(fieldInfo.name);- if (readerFieldInfo != null && readerFieldInfo.getPointDataDimensionCount() > 0) {+ if (readerFieldInfo != null && readerFieldInfo.getPointDimensionCount() > 0) {PointValues values = reader.getValues(fieldInfo.name);if (values != null) {totMaxSize += values.size();@@ -177,7 +177,7 @@ public class Lucene60PointsWriter extends PointsWriter implements Closeable {try (BKDWriter writer = new BKDWriter(writeState.segmentInfo.maxDoc(),writeState.directory,writeState.segmentInfo.name,- fieldInfo.getPointDataDimensionCount(),+ fieldInfo.getPointDimensionCount(),fieldInfo.getPointIndexDimensionCount(),fieldInfo.getPointNumBytes(),maxPointsInLeafNode,@@ -200,7 +200,7 @@ public class Lucene60PointsWriter extends PointsWriter implements Closeable {FieldInfos readerFieldInfos = mergeState.fieldInfos[i];FieldInfo readerFieldInfo = readerFieldInfos.fieldInfo(fieldInfo.name);- if (readerFieldInfo != null && readerFieldInfo.getPointDataDimensionCount() > 0) {+ if (readerFieldInfo != null && readerFieldInfo.getPointDimensionCount() > 0) {BKDReader bkdReader = reader60.readers.get(readerFieldInfo.number);if (bkdReader != null) {bkdReaders.add(bkdReader);diff --git a/lucene/core/src/java/org/apache/lucene/codecs/perfield/PerFieldMergeState.java b/lucene/core/src/java/org/apache/lucene/codecs/perfield/PerFieldMergeState.javaindex 99a04da0422..7f0764abd53 100644--- a/lucene/core/src/java/org/apache/lucene/codecs/perfield/PerFieldMergeState.java+++ b/lucene/core/src/java/org/apache/lucene/codecs/perfield/PerFieldMergeState.java@@ -134,7 +134,7 @@ final class PerFieldMergeState {hasNorms |= fi.hasNorms();hasDocValues |= fi.getDocValuesType() != DocValuesType.NONE;hasPayloads |= fi.hasPayloads();- hasPointValues |= (fi.getPointDataDimensionCount() != 0);+ hasPointValues |= (fi.getPointDimensionCount() != 0);}}diff --git a/lucene/core/src/java/org/apache/lucene/document/BinaryPoint.java b/lucene/core/src/java/org/apache/lucene/document/BinaryPoint.javaindex aa62f223aa4..dd47f59b3be 100644--- a/lucene/core/src/java/org/apache/lucene/document/BinaryPoint.java+++ b/lucene/core/src/java/org/apache/lucene/document/BinaryPoint.java@@ -123,8 +123,8 @@ public final class BinaryPoint extends Field {/** Expert API */public BinaryPoint(String name, byte[] packedPoint, IndexableFieldType type) {super(name, packedPoint, type);- if (packedPoint.length != type.pointDataDimensionCount() * type.pointNumBytes()) {- throw new IllegalArgumentException("packedPoint is length=" + packedPoint.length + " but type.pointDimensionCount()=" + type.pointDataDimensionCount() + " and type.pointNumBytes()=" + type.pointNumBytes());+ if (packedPoint.length != type.pointDimensionCount() * type.pointNumBytes()) {+ throw new IllegalArgumentException("packedPoint is length=" + packedPoint.length + " but type.pointDimensionCount()=" + type.pointDimensionCount() + " and type.pointNumBytes()=" + type.pointNumBytes());}}diff --git a/lucene/core/src/java/org/apache/lucene/document/DoublePoint.java b/lucene/core/src/java/org/apache/lucene/document/DoublePoint.javaindex 29a4211a9f0..9b8be2297db 100644--- a/lucene/core/src/java/org/apache/lucene/document/DoublePoint.java+++ b/lucene/core/src/java/org/apache/lucene/document/DoublePoint.java@@ -84,8 +84,8 @@ public final class DoublePoint extends Field {/** Change the values of this field */public void setDoubleValues(double... point) {- if (type.pointDataDimensionCount() != point.length) {- throw new IllegalArgumentException("this field (name=" + name + ") uses " + type.pointDataDimensionCount() + " dimensions; cannot change to (incoming) " + point.length + " dimensions");+ if (type.pointDimensionCount() != point.length) {+ throw new IllegalArgumentException("this field (name=" + name + ") uses " + type.pointDimensionCount() + " dimensions; cannot change to (incoming) " + point.length + " dimensions");}fieldsData = pack(point);}@@ -97,8 +97,8 @@ public final class DoublePoint extends Field {@Overridepublic Number numericValue() {- if (type.pointDataDimensionCount() != 1) {- throw new IllegalStateException("this field (name=" + name + ") uses " + type.pointDataDimensionCount() + " dimensions; cannot convert to a single numeric value");+ if (type.pointDimensionCount() != 1) {+ throw new IllegalStateException("this field (name=" + name + ") uses " + type.pointDimensionCount() + " dimensions; cannot convert to a single numeric value");}BytesRef bytes = (BytesRef) fieldsData;assert bytes.length == Double.BYTES;@@ -147,7 +147,7 @@ public final class DoublePoint extends Field {result.append(':');BytesRef bytes = (BytesRef) fieldsData;- for (int dim = 0; dim < type.pointDataDimensionCount(); dim++) {+ for (int dim = 0; dim < type.pointDimensionCount(); dim++) {if (dim > 0) {result.append(',');}diff --git a/lucene/core/src/java/org/apache/lucene/document/DoubleRange.java b/lucene/core/src/java/org/apache/lucene/document/DoubleRange.javaindex b5c3eb936b0..a540943204e 100644--- a/lucene/core/src/java/org/apache/lucene/document/DoubleRange.java+++ b/lucene/core/src/java/org/apache/lucene/document/DoubleRange.java@@ -78,8 +78,8 @@ public class DoubleRange extends Field {*/public void setRangeValues(double[] min, double[] max) {checkArgs(min, max);- if (min.length*2 != type.pointDataDimensionCount() || max.length*2 != type.pointDataDimensionCount()) {- throw new IllegalArgumentException("field (name=" + name + ") uses " + type.pointDataDimensionCount()/2+ if (min.length*2 != type.pointDimensionCount() || max.length*2 != type.pointDimensionCount()) {+ throw new IllegalArgumentException("field (name=" + name + ") uses " + type.pointDimensionCount()/2+ " dimensions; cannot change to (incoming) " + min.length + " dimensions");}@@ -149,7 +149,7 @@ public class DoubleRange extends Field {* @return the decoded min value*/public double getMin(int dimension) {- Objects.checkIndex(dimension, type.pointDataDimensionCount()/2);+ Objects.checkIndex(dimension, type.pointDimensionCount()/2);return decodeMin(((BytesRef)fieldsData).bytes, dimension);}@@ -159,7 +159,7 @@ public class DoubleRange extends Field {* @return the decoded max value*/public double getMax(int dimension) {- Objects.checkIndex(dimension, type.pointDataDimensionCount()/2);+ Objects.checkIndex(dimension, type.pointDimensionCount()/2);return decodeMax(((BytesRef)fieldsData).bytes, dimension);}@@ -245,7 +245,7 @@ public class DoubleRange extends Field {sb.append(':');byte[] b = ((BytesRef)fieldsData).bytes;toString(b, 0);- for (int d = 0; d < type.pointDataDimensionCount() / 2; ++d) {+ for (int d = 0; d < type.pointDimensionCount() / 2; ++d) {sb.append(' ');sb.append(toString(b, d));}diff --git a/lucene/core/src/java/org/apache/lucene/document/FieldType.java b/lucene/core/src/java/org/apache/lucene/document/FieldType.javaindex 8dd802c6970..82a6454a525 100644--- a/lucene/core/src/java/org/apache/lucene/document/FieldType.java+++ b/lucene/core/src/java/org/apache/lucene/document/FieldType.java@@ -41,7 +41,7 @@ public class FieldType implements IndexableFieldType {private IndexOptions indexOptions = IndexOptions.NONE;private boolean frozen;private DocValuesType docValuesType = DocValuesType.NONE;- private int dataDimensionCount;+ private int dimensionCount;private int indexDimensionCount;private int dimensionNumBytes;private Map<String, String> attributes;@@ -59,7 +59,7 @@ public class FieldType implements IndexableFieldType {this.omitNorms = ref.omitNorms();this.indexOptions = ref.indexOptions();this.docValuesType = ref.docValuesType();- this.dataDimensionCount = ref.pointDataDimensionCount();+ this.dimensionCount = ref.pointDimensionCount();this.indexDimensionCount = ref.pointIndexDimensionCount();this.dimensionNumBytes = ref.pointNumBytes();if (ref.getAttributes() != null) {@@ -294,18 +294,21 @@ public class FieldType implements IndexableFieldType {/*** Enables points indexing with selectable dimension indexing.*/- public void setDimensions(int dataDimensionCount, int indexDimensionCount, int dimensionNumBytes) {- if (dataDimensionCount < 0) {- throw new IllegalArgumentException("dataDimensionCount must be >= 0; got " + dataDimensionCount);+ public void setDimensions(int dimensionCount, int indexDimensionCount, int dimensionNumBytes) {+ if (dimensionCount < 0) {+ throw new IllegalArgumentException("dimensionCount must be >= 0; got " + dimensionCount);}- if (dataDimensionCount > PointValues.MAX_DIMENSIONS) {- throw new IllegalArgumentException("dataDimensionCount must be <= " + PointValues.MAX_DIMENSIONS + "; got " + dataDimensionCount);+ if (dimensionCount > PointValues.MAX_DIMENSIONS) {+ throw new IllegalArgumentException("dimensionCount must be <= " + PointValues.MAX_DIMENSIONS + "; got " + dimensionCount);}if (indexDimensionCount < 0) {throw new IllegalArgumentException("indexDimensionCount must be >= 0; got " + indexDimensionCount);}- if (indexDimensionCount > dataDimensionCount) {- throw new IllegalArgumentException("indexDimensionCount must be <= dataDimensionCount: " + dataDimensionCount + "; got " + indexDimensionCount);+ if (indexDimensionCount > dimensionCount) {+ throw new IllegalArgumentException("indexDimensionCount must be <= dimensionCount: " + dimensionCount + "; got " + indexDimensionCount);+ }+ if (indexDimensionCount > PointValues.MAX_INDEX_DIMENSIONS) {+ throw new IllegalArgumentException("indexDimensionCount must be <= " + PointValues.MAX_INDEX_DIMENSIONS + "; got " + indexDimensionCount);}if (dimensionNumBytes < 0) {throw new IllegalArgumentException("dimensionNumBytes must be >= 0; got " + dimensionNumBytes);@@ -313,29 +316,29 @@ public class FieldType implements IndexableFieldType {if (dimensionNumBytes > PointValues.MAX_NUM_BYTES) {throw new IllegalArgumentException("dimensionNumBytes must be <= " + PointValues.MAX_NUM_BYTES + "; got " + dimensionNumBytes);}- if (dataDimensionCount == 0) {+ if (dimensionCount == 0) {if (indexDimensionCount != 0) {- throw new IllegalArgumentException("when dataDimensionCount is 0, indexDimensionCount must be 0; got " + indexDimensionCount);+ throw new IllegalArgumentException("when dimensionCount is 0, indexDimensionCount must be 0; got " + indexDimensionCount);}if (dimensionNumBytes != 0) {- throw new IllegalArgumentException("when dataDimensionCount is 0, dimensionNumBytes must be 0; got " + dimensionNumBytes);+ throw new IllegalArgumentException("when dimensionCount is 0, dimensionNumBytes must be 0; got " + dimensionNumBytes);}} else if (indexDimensionCount == 0) {- throw new IllegalArgumentException("when dataDimensionCount is > 0, indexDimensionCount must be > 0; got " + indexDimensionCount);+ throw new IllegalArgumentException("when dimensionCount is > 0, indexDimensionCount must be > 0; got " + indexDimensionCount);} else if (dimensionNumBytes == 0) {- if (dataDimensionCount != 0) {- throw new IllegalArgumentException("when dimensionNumBytes is 0, dataDimensionCount must be 0; got " + dataDimensionCount);+ if (dimensionCount != 0) {+ throw new IllegalArgumentException("when dimensionNumBytes is 0, dimensionCount must be 0; got " + dimensionCount);}}- this.dataDimensionCount = dataDimensionCount;+ this.dimensionCount = dimensionCount;this.indexDimensionCount = indexDimensionCount;this.dimensionNumBytes = dimensionNumBytes;}@Override- public int pointDataDimensionCount() {- return dataDimensionCount;+ public int pointDimensionCount() {+ return dimensionCount;}@Override@@ -407,12 +410,12 @@ public class FieldType implements IndexableFieldType {result.append(indexOptions);}}- if (dataDimensionCount != 0) {+ if (dimensionCount != 0) {if (result.length() > 0) {result.append(",");}- result.append("pointDataDimensionCount=");- result.append(dataDimensionCount);+ result.append("pointDimensionCount=");+ result.append(dimensionCount);result.append(",pointIndexDimensionCount=");result.append(indexDimensionCount);result.append(",pointNumBytes=");@@ -459,7 +462,7 @@ public class FieldType implements IndexableFieldType {public int hashCode() {final int prime = 31;int result = 1;- result = prime * result + dataDimensionCount;+ result = prime * result + dimensionCount;result = prime * result + indexDimensionCount;result = prime * result + dimensionNumBytes;result = prime * result + ((docValuesType == null) ? 0 : docValuesType.hashCode());@@ -480,7 +483,7 @@ public class FieldType implements IndexableFieldType {if (obj == null) return false;if (getClass() != obj.getClass()) return false;FieldType other = (FieldType) obj;- if (dataDimensionCount != other.dataDimensionCount) return false;+ if (dimensionCount != other.dimensionCount) return false;if (indexDimensionCount != other.indexDimensionCount) return false;if (dimensionNumBytes != other.dimensionNumBytes) return false;if (docValuesType != other.docValuesType) return false;diff --git a/lucene/core/src/java/org/apache/lucene/document/FloatPoint.java b/lucene/core/src/java/org/apache/lucene/document/FloatPoint.javaindex fea8db574f1..92efa5efc60 100644--- a/lucene/core/src/java/org/apache/lucene/document/FloatPoint.java+++ b/lucene/core/src/java/org/apache/lucene/document/FloatPoint.java@@ -84,8 +84,8 @@ public final class FloatPoint extends Field {/** Change the values of this field */public void setFloatValues(float... point) {- if (type.pointDataDimensionCount() != point.length) {- throw new IllegalArgumentException("this field (name=" + name + ") uses " + type.pointDataDimensionCount() + " dimensions; cannot change to (incoming) " + point.length + " dimensions");+ if (type.pointDimensionCount() != point.length) {+ throw new IllegalArgumentException("this field (name=" + name + ") uses " + type.pointDimensionCount() + " dimensions; cannot change to (incoming) " + point.length + " dimensions");}fieldsData = pack(point);}@@ -97,8 +97,8 @@ public final class FloatPoint extends Field {@Overridepublic Number numericValue() {- if (type.pointDataDimensionCount() != 1) {- throw new IllegalStateException("this field (name=" + name + ") uses " + type.pointDataDimensionCount() + " dimensions; cannot convert to a single numeric value");+ if (type.pointDimensionCount() != 1) {+ throw new IllegalStateException("this field (name=" + name + ") uses " + type.pointDimensionCount() + " dimensions; cannot convert to a single numeric value");}BytesRef bytes = (BytesRef) fieldsData;assert bytes.length == Float.BYTES;@@ -147,7 +147,7 @@ public final class FloatPoint extends Field {result.append(':');BytesRef bytes = (BytesRef) fieldsData;- for (int dim = 0; dim < type.pointDataDimensionCount(); dim++) {+ for (int dim = 0; dim < type.pointDimensionCount(); dim++) {if (dim > 0) {result.append(',');}diff --git a/lucene/core/src/java/org/apache/lucene/document/FloatRange.java b/lucene/core/src/java/org/apache/lucene/document/FloatRange.javaindex 32295191502..a74936f5881 100644--- a/lucene/core/src/java/org/apache/lucene/document/FloatRange.java+++ b/lucene/core/src/java/org/apache/lucene/document/FloatRange.java@@ -78,8 +78,8 @@ public class FloatRange extends Field {*/public void setRangeValues(float[] min, float[] max) {checkArgs(min, max);- if (min.length*2 != type.pointDataDimensionCount() || max.length*2 != type.pointDataDimensionCount()) {- throw new IllegalArgumentException("field (name=" + name + ") uses " + type.pointDataDimensionCount()/2+ if (min.length*2 != type.pointDimensionCount() || max.length*2 != type.pointDimensionCount()) {+ throw new IllegalArgumentException("field (name=" + name + ") uses " + type.pointDimensionCount()/2+ " dimensions; cannot change to (incoming) " + min.length + " dimensions");}@@ -149,7 +149,7 @@ public class FloatRange extends Field {* @return the decoded min value*/public float getMin(int dimension) {- Objects.checkIndex(dimension, type.pointDataDimensionCount()/2);+ Objects.checkIndex(dimension, type.pointDimensionCount()/2);return decodeMin(((BytesRef)fieldsData).bytes, dimension);}@@ -159,7 +159,7 @@ public class FloatRange extends Field {* @return the decoded max value*/public float getMax(int dimension) {- Objects.checkIndex(dimension, type.pointDataDimensionCount()/2);+ Objects.checkIndex(dimension, type.pointDimensionCount()/2);return decodeMax(((BytesRef)fieldsData).bytes, dimension);}@@ -245,7 +245,7 @@ public class FloatRange extends Field {sb.append(':');byte[] b = ((BytesRef)fieldsData).bytes;toString(b, 0);- for (int d = 0; d < type.pointDataDimensionCount() / 2; ++d) {+ for (int d = 0; d < type.pointDimensionCount() / 2; ++d) {sb.append(' ');sb.append(toString(b, d));}diff --git a/lucene/core/src/java/org/apache/lucene/document/IntPoint.java b/lucene/core/src/java/org/apache/lucene/document/IntPoint.javaindex 671a900fa66..c138f501abc 100644--- a/lucene/core/src/java/org/apache/lucene/document/IntPoint.java+++ b/lucene/core/src/java/org/apache/lucene/document/IntPoint.java@@ -58,8 +58,8 @@ public final class IntPoint extends Field {/** Change the values of this field */public void setIntValues(int... point) {- if (type.pointDataDimensionCount() != point.length) {- throw new IllegalArgumentException("this field (name=" + name + ") uses " + type.pointDataDimensionCount() + " dimensions; cannot change to (incoming) " + point.length + " dimensions");+ if (type.pointDimensionCount() != point.length) {+ throw new IllegalArgumentException("this field (name=" + name + ") uses " + type.pointDimensionCount() + " dimensions; cannot change to (incoming) " + point.length + " dimensions");}fieldsData = pack(point);}@@ -71,8 +71,8 @@ public final class IntPoint extends Field {@Overridepublic Number numericValue() {- if (type.pointDataDimensionCount() != 1) {- throw new IllegalStateException("this field (name=" + name + ") uses " + type.pointDataDimensionCount() + " dimensions; cannot convert to a single numeric value");+ if (type.pointDimensionCount() != 1) {+ throw new IllegalStateException("this field (name=" + name + ") uses " + type.pointDimensionCount() + " dimensions; cannot convert to a single numeric value");}BytesRef bytes = (BytesRef) fieldsData;assert bytes.length == Integer.BYTES;@@ -121,7 +121,7 @@ public final class IntPoint extends Field {result.append(':');BytesRef bytes = (BytesRef) fieldsData;- for (int dim = 0; dim < type.pointDataDimensionCount(); dim++) {+ for (int dim = 0; dim < type.pointDimensionCount(); dim++) {if (dim > 0) {result.append(',');}diff --git a/lucene/core/src/java/org/apache/lucene/document/IntRange.java b/lucene/core/src/java/org/apache/lucene/document/IntRange.javaindex 052f6b4d824..b03fe8f0243 100644--- a/lucene/core/src/java/org/apache/lucene/document/IntRange.java+++ b/lucene/core/src/java/org/apache/lucene/document/IntRange.java@@ -78,8 +78,8 @@ public class IntRange extends Field {*/public void setRangeValues(int[] min, int[] max) {checkArgs(min, max);- if (min.length*2 != type.pointDataDimensionCount() || max.length*2 != type.pointDataDimensionCount()) {- throw new IllegalArgumentException("field (name=" + name + ") uses " + type.pointDataDimensionCount()/2+ if (min.length*2 != type.pointDimensionCount() || max.length*2 != type.pointDimensionCount()) {+ throw new IllegalArgumentException("field (name=" + name + ") uses " + type.pointDimensionCount()/2+ " dimensions; cannot change to (incoming) " + min.length + " dimensions");}@@ -149,7 +149,7 @@ public class IntRange extends Field {* @return the decoded min value*/public int getMin(int dimension) {- Objects.checkIndex(dimension, type.pointDataDimensionCount()/2);+ Objects.checkIndex(dimension, type.pointDimensionCount()/2);return decodeMin(((BytesRef)fieldsData).bytes, dimension);}@@ -159,7 +159,7 @@ public class IntRange extends Field {* @return the decoded max value*/public int getMax(int dimension) {- Objects.checkIndex(dimension, type.pointDataDimensionCount()/2);+ Objects.checkIndex(dimension, type.pointDimensionCount()/2);return decodeMax(((BytesRef)fieldsData).bytes, dimension);}@@ -245,7 +245,7 @@ public class IntRange extends Field {sb.append(':');byte[] b = ((BytesRef)fieldsData).bytes;toString(b, 0);- for (int d = 0; d < type.pointDataDimensionCount() / 2; ++d) {+ for (int d = 0; d < type.pointDimensionCount() / 2; ++d) {sb.append(' ');sb.append(toString(b, d));}diff --git a/lucene/core/src/java/org/apache/lucene/document/LatLonPoint.java b/lucene/core/src/java/org/apache/lucene/document/LatLonPoint.javaindex c3ecc8aed21..22f20c994c1 100644--- a/lucene/core/src/java/org/apache/lucene/document/LatLonPoint.java+++ b/lucene/core/src/java/org/apache/lucene/document/LatLonPoint.java@@ -147,9 +147,9 @@ public class LatLonPoint extends Field {/** helper: checks a fieldinfo and throws exception if its definitely not a LatLonPoint */static void checkCompatible(FieldInfo fieldInfo) {// point/dv properties could be "unset", if you e.g. used only StoredField with this same name in the segment.- if (fieldInfo.getPointDataDimensionCount() != 0 && fieldInfo.getPointDataDimensionCount() != TYPE.pointDataDimensionCount()) {- throw new IllegalArgumentException("field=\"" + fieldInfo.name + "\" was indexed with numDims=" + fieldInfo.getPointDataDimensionCount() +- " but this point type has numDims=" + TYPE.pointDataDimensionCount() ++ if (fieldInfo.getPointDimensionCount() != 0 && fieldInfo.getPointDimensionCount() != TYPE.pointDimensionCount()) {+ throw new IllegalArgumentException("field=\"" + fieldInfo.name + "\" was indexed with numDims=" + fieldInfo.getPointDimensionCount() ++ " but this point type has numDims=" + TYPE.pointDimensionCount() +", is the field really a LatLonPoint?");}if (fieldInfo.getPointNumBytes() != 0 && fieldInfo.getPointNumBytes() != TYPE.pointNumBytes()) {diff --git a/lucene/core/src/java/org/apache/lucene/document/LongPoint.java b/lucene/core/src/java/org/apache/lucene/document/LongPoint.javaindex 28a6a59a3fe..d26660fcc9f 100644--- a/lucene/core/src/java/org/apache/lucene/document/LongPoint.java+++ b/lucene/core/src/java/org/apache/lucene/document/LongPoint.java@@ -61,8 +61,8 @@ public final class LongPoint extends Field {/** Change the values of this field */public void setLongValues(long... point) {- if (type.pointDataDimensionCount() != point.length) {- throw new IllegalArgumentException("this field (name=" + name + ") uses " + type.pointDataDimensionCount() + " dimensions; cannot change to (incoming) " + point.length + " dimensions");+ if (type.pointDimensionCount() != point.length) {+ throw new IllegalArgumentException("this field (name=" + name + ") uses " + type.pointDimensionCount() + " dimensions; cannot change to (incoming) " + point.length + " dimensions");}fieldsData = pack(point);}@@ -74,8 +74,8 @@ public final class LongPoint extends Field {@Overridepublic Number numericValue() {- if (type.pointDataDimensionCount() != 1) {- throw new IllegalStateException("this field (name=" + name + ") uses " + type.pointDataDimensionCount() + " dimensions; cannot convert to a single numeric value");+ if (type.pointDimensionCount() != 1) {+ throw new IllegalStateException("this field (name=" + name + ") uses " + type.pointDimensionCount() + " dimensions; cannot convert to a single numeric value");}BytesRef bytes = (BytesRef) fieldsData;assert bytes.length == Long.BYTES;@@ -124,7 +124,7 @@ public final class LongPoint extends Field {result.append(':');BytesRef bytes = (BytesRef) fieldsData;- for (int dim = 0; dim < type.pointDataDimensionCount(); dim++) {+ for (int dim = 0; dim < type.pointDimensionCount(); dim++) {if (dim > 0) {result.append(',');}diff --git a/lucene/core/src/java/org/apache/lucene/document/LongRange.java b/lucene/core/src/java/org/apache/lucene/document/LongRange.javaindex ef5296d3943..f49ae156406 100644--- a/lucene/core/src/java/org/apache/lucene/document/LongRange.java+++ b/lucene/core/src/java/org/apache/lucene/document/LongRange.java@@ -78,8 +78,8 @@ public class LongRange extends Field {*/public void setRangeValues(long[] min, long[] max) {checkArgs(min, max);- if (min.length*2 != type.pointDataDimensionCount() || max.length*2 != type.pointDataDimensionCount()) {- throw new IllegalArgumentException("field (name=" + name + ") uses " + type.pointDataDimensionCount()/2+ if (min.length*2 != type.pointDimensionCount() || max.length*2 != type.pointDimensionCount()) {+ throw new IllegalArgumentException("field (name=" + name + ") uses " + type.pointDimensionCount()/2+ " dimensions; cannot change to (incoming) " + min.length + " dimensions");}@@ -147,7 +147,7 @@ public class LongRange extends Field {* @return the decoded min value*/public long getMin(int dimension) {- Objects.checkIndex(dimension, type.pointDataDimensionCount()/2);+ Objects.checkIndex(dimension, type.pointDimensionCount()/2);return decodeMin(((BytesRef)fieldsData).bytes, dimension);}@@ -157,7 +157,7 @@ public class LongRange extends Field {* @return the decoded max value*/public long getMax(int dimension) {- Objects.checkIndex(dimension, type.pointDataDimensionCount()/2);+ Objects.checkIndex(dimension, type.pointDimensionCount()/2);return decodeMax(((BytesRef)fieldsData).bytes, dimension);}@@ -243,7 +243,7 @@ public class LongRange extends Field {sb.append(':');byte[] b = ((BytesRef)fieldsData).bytes;toString(b, 0);- for (int d = 0; d < type.pointDataDimensionCount() / 2; ++d) {+ for (int d = 0; d < type.pointDimensionCount() / 2; ++d) {sb.append(' ');sb.append(toString(b, d));}diff --git a/lucene/core/src/java/org/apache/lucene/document/RangeFieldQuery.java b/lucene/core/src/java/org/apache/lucene/document/RangeFieldQuery.javaindex e903b006b31..9f87862664c 100644--- a/lucene/core/src/java/org/apache/lucene/document/RangeFieldQuery.java+++ b/lucene/core/src/java/org/apache/lucene/document/RangeFieldQuery.java@@ -255,9 +255,9 @@ abstract class RangeFieldQuery extends Query {/** Check indexed field info against the provided query data. */private void checkFieldInfo(FieldInfo fieldInfo) {- if (fieldInfo.getPointDataDimensionCount()/2 != numDims) {+ if (fieldInfo.getPointDimensionCount()/2 != numDims) {throw new IllegalArgumentException("field=\"" + field + "\" was indexed with numDims="- + fieldInfo.getPointDataDimensionCount()/2 + " but this query has numDims=" + numDims);+ + fieldInfo.getPointDimensionCount()/2 + " but this query has numDims=" + numDims);}}diff --git a/lucene/core/src/java/org/apache/lucene/index/CheckIndex.java b/lucene/core/src/java/org/apache/lucene/index/CheckIndex.javaindex ffbd7e5ef53..45552d0ed0b 100644--- a/lucene/core/src/java/org/apache/lucene/index/CheckIndex.java+++ b/lucene/core/src/java/org/apache/lucene/index/CheckIndex.java@@ -1902,7 +1902,7 @@ public final class CheckIndex implements Closeable {throw new RuntimeException("there are fields with points, but reader.getPointsReader() is null");}for (FieldInfo fieldInfo : fieldInfos) {- if (fieldInfo.getPointDataDimensionCount() > 0) {+ if (fieldInfo.getPointDimensionCount() > 0) {PointValues values = pointsReader.getValues(fieldInfo.name);if (values == null) {continue;@@ -1982,7 +1982,7 @@ public final class CheckIndex implements Closeable {public VerifyPointsVisitor(String fieldName, int maxDoc, PointValues values) throws IOException {this.maxDoc = maxDoc;this.fieldName = fieldName;- numDataDims = values.getNumDataDimensions();+ numDataDims = values.getNumDimensions();numIndexDims = values.getNumIndexDimensions();bytesPerDim = values.getBytesPerDimension();packedBytesCount = numDataDims * bytesPerDim;diff --git a/lucene/core/src/java/org/apache/lucene/index/CodecReader.java b/lucene/core/src/java/org/apache/lucene/index/CodecReader.javaindex af90c7b6763..4459ab11edd 100644--- a/lucene/core/src/java/org/apache/lucene/index/CodecReader.java+++ b/lucene/core/src/java/org/apache/lucene/index/CodecReader.java@@ -194,7 +194,7 @@ public abstract class CodecReader extends LeafReader implements Accountable {public final PointValues getPointValues(String field) throws IOException {ensureOpen();FieldInfo fi = getFieldInfos().fieldInfo(field);- if (fi == null || fi.getPointDataDimensionCount() == 0) {+ if (fi == null || fi.getPointDimensionCount() == 0) {// Field does not exist or does not index pointsreturn null;}diff --git a/lucene/core/src/java/org/apache/lucene/index/DefaultIndexingChain.java b/lucene/core/src/java/org/apache/lucene/index/DefaultIndexingChain.javaindex 12bfe07d486..0d455b559b2 100644--- a/lucene/core/src/java/org/apache/lucene/index/DefaultIndexingChain.java+++ b/lucene/core/src/java/org/apache/lucene/index/DefaultIndexingChain.java@@ -202,7 +202,7 @@ final class DefaultIndexingChain extends DocConsumer {PerField perField = fieldHash[i];while (perField != null) {if (perField.pointValuesWriter != null) {- if (perField.fieldInfo.getPointDataDimensionCount() == 0) {+ if (perField.fieldInfo.getPointDimensionCount() == 0) {// BUGthrow new AssertionError("segment=" + state.segmentInfo + ": field=\"" + perField.fieldInfo.name + "\" has no points but wrote them");}@@ -217,7 +217,7 @@ final class DefaultIndexingChain extends DocConsumer {perField.pointValuesWriter.flush(state, sortMap, pointsWriter);perField.pointValuesWriter = null;- } else if (perField.fieldInfo.getPointDataDimensionCount() != 0) {+ } else if (perField.fieldInfo.getPointDimensionCount() != 0) {// BUGthrow new AssertionError("segment=" + state.segmentInfo + ": field=\"" + perField.fieldInfo.name + "\" has points but did not write them");}@@ -478,7 +478,7 @@ final class DefaultIndexingChain extends DocConsumer {}indexDocValue(fp, dvType, field);}- if (fieldType.pointDataDimensionCount() != 0) {+ if (fieldType.pointDimensionCount() != 0) {if (fp == null) {fp = getOrAddField(fieldName, fieldType, false);}@@ -509,18 +509,18 @@ final class DefaultIndexingChain extends DocConsumer {/** Called from processDocument to index one field's point */private void indexPoint(PerField fp, IndexableField field) throws IOException {- int pointDataDimensionCount = field.fieldType().pointDataDimensionCount();+ int pointDimensionCount = field.fieldType().pointDimensionCount();int pointIndexDimensionCount = field.fieldType().pointIndexDimensionCount();int dimensionNumBytes = field.fieldType().pointNumBytes();// Record dimensions for this field; this setter will throw IllegalArgExc if// the dimensions were already set to something different:- if (fp.fieldInfo.getPointDataDimensionCount() == 0) {- fieldInfos.globalFieldNumbers.setDimensions(fp.fieldInfo.number, fp.fieldInfo.name, pointDataDimensionCount, pointIndexDimensionCount, dimensionNumBytes);+ if (fp.fieldInfo.getPointDimensionCount() == 0) {+ fieldInfos.globalFieldNumbers.setDimensions(fp.fieldInfo.number, fp.fieldInfo.name, pointDimensionCount, pointIndexDimensionCount, dimensionNumBytes);}- fp.fieldInfo.setPointDimensions(pointDataDimensionCount, pointIndexDimensionCount, dimensionNumBytes);+ fp.fieldInfo.setPointDimensions(pointDimensionCount, pointIndexDimensionCount, dimensionNumBytes);if (fp.pointValuesWriter == null) {fp.pointValuesWriter = new PointValuesWriter(docWriter, fp.fieldInfo);diff --git a/lucene/core/src/java/org/apache/lucene/index/ExitableDirectoryReader.java b/lucene/core/src/java/org/apache/lucene/index/ExitableDirectoryReader.javaindex f66a9017adc..d80529e85b3 100644--- a/lucene/core/src/java/org/apache/lucene/index/ExitableDirectoryReader.java+++ b/lucene/core/src/java/org/apache/lucene/index/ExitableDirectoryReader.java@@ -376,9 +376,9 @@ public class ExitableDirectoryReader extends FilterDirectoryReader {}@Override- public int getNumDataDimensions() throws IOException {+ public int getNumDimensions() throws IOException {checkAndThrow();- return in.getNumDataDimensions();+ return in.getNumDimensions();}@Overridediff --git a/lucene/core/src/java/org/apache/lucene/index/FieldInfo.java b/lucene/core/src/java/org/apache/lucene/index/FieldInfo.javaindex 534652363f1..58b5a66f6bc 100644--- a/lucene/core/src/java/org/apache/lucene/index/FieldInfo.java+++ b/lucene/core/src/java/org/apache/lucene/index/FieldInfo.java@@ -50,7 +50,7 @@ public final class FieldInfo {/** If both of these are positive it means this field indexed points* (see {@link org.apache.lucene.codecs.PointsFormat}). */- private int pointDataDimensionCount;+ private int pointDimensionCount;private int pointIndexDimensionCount;private int pointNumBytes;@@ -64,7 +64,7 @@ public final class FieldInfo {*/public FieldInfo(String name, int number, boolean storeTermVector, boolean omitNorms, boolean storePayloads,IndexOptions indexOptions, DocValuesType docValues, long dvGen, Map<String,String> attributes,- int pointDataDimensionCount, int pointIndexDimensionCount, int pointNumBytes, boolean softDeletesField) {+ int pointDimensionCount, int pointIndexDimensionCount, int pointNumBytes, boolean softDeletesField) {this.name = Objects.requireNonNull(name);this.number = number;this.docValuesType = Objects.requireNonNull(docValues, "DocValuesType must not be null (field: \"" + name + "\")");@@ -80,7 +80,7 @@ public final class FieldInfo {}this.dvGen = dvGen;this.attributes = Objects.requireNonNull(attributes);- this.pointDataDimensionCount = pointDataDimensionCount;+ this.pointDimensionCount = pointDimensionCount;this.pointIndexDimensionCount = pointIndexDimensionCount;this.pointNumBytes = pointNumBytes;this.softDeletesField = softDeletesField;@@ -109,8 +109,8 @@ public final class FieldInfo {}}- if (pointDataDimensionCount < 0) {- throw new IllegalStateException("pointDataDimensionCount must be >= 0; got " + pointDataDimensionCount);+ if (pointDimensionCount < 0) {+ throw new IllegalStateException("pointDimensionCount must be >= 0; got " + pointDimensionCount);}if (pointIndexDimensionCount < 0) {@@ -121,16 +121,16 @@ public final class FieldInfo {throw new IllegalStateException("pointNumBytes must be >= 0; got " + pointNumBytes);}- if (pointDataDimensionCount != 0 && pointNumBytes == 0) {- throw new IllegalStateException("pointNumBytes must be > 0 when pointDataDimensionCount=" + pointDataDimensionCount);+ if (pointDimensionCount != 0 && pointNumBytes == 0) {+ throw new IllegalStateException("pointNumBytes must be > 0 when pointDimensionCount=" + pointDimensionCount);}- if (pointIndexDimensionCount != 0 && pointDataDimensionCount == 0) {- throw new IllegalStateException("pointIndexDimensionCount must be 0 when pointDataDimensionCount=0");+ if (pointIndexDimensionCount != 0 && pointDimensionCount == 0) {+ throw new IllegalStateException("pointIndexDimensionCount must be 0 when pointDimensionCount=0");}- if (pointNumBytes != 0 && pointDataDimensionCount == 0) {- throw new IllegalStateException("pointDataDimensionCount must be > 0 when pointNumBytes=" + pointNumBytes);+ if (pointNumBytes != 0 && pointDimensionCount == 0) {+ throw new IllegalStateException("pointDimensionCount must be > 0 when pointNumBytes=" + pointNumBytes);}if (dvGen != -1 && docValuesType == DocValuesType.NONE) {@@ -142,7 +142,7 @@ public final class FieldInfo {// should only be called by FieldInfos#addOrUpdatevoid update(boolean storeTermVector, boolean omitNorms, boolean storePayloads, IndexOptions indexOptions,- Map<String, String> attributes, int dataDimensionCount, int indexDimensionCount, int dimensionNumBytes) {+ Map<String, String> attributes, int dimensionCount, int indexDimensionCount, int dimensionNumBytes) {if (indexOptions == null) {throw new NullPointerException("IndexOptions must not be null (field: \"" + name + "\")");}@@ -155,12 +155,12 @@ public final class FieldInfo {}}- if (this.pointDataDimensionCount == 0 && dataDimensionCount != 0) {- this.pointDataDimensionCount = dataDimensionCount;+ if (this.pointDimensionCount == 0 && dimensionCount != 0) {+ this.pointDimensionCount = dimensionCount;this.pointIndexDimensionCount = indexDimensionCount;this.pointNumBytes = dimensionNumBytes;- } else if (dataDimensionCount != 0 && (this.pointDataDimensionCount != dataDimensionCount || this.pointIndexDimensionCount != indexDimensionCount || this.pointNumBytes != dimensionNumBytes)) {- throw new IllegalArgumentException("cannot change field \"" + name + "\" from points dataDimensionCount=" + this.pointDataDimensionCount + ", indexDimensionCount=" + this.pointIndexDimensionCount + ", numBytes=" + this.pointNumBytes + " to inconsistent dataDimensionCount=" + dataDimensionCount +", indexDimensionCount=" + indexDimensionCount + ", numBytes=" + dimensionNumBytes);+ } else if (dimensionCount != 0 && (this.pointDimensionCount != dimensionCount || this.pointIndexDimensionCount != indexDimensionCount || this.pointNumBytes != dimensionNumBytes)) {+ throw new IllegalArgumentException("cannot change field \"" + name + "\" from points dimensionCount=" + this.pointDimensionCount + ", indexDimensionCount=" + this.pointIndexDimensionCount + ", numBytes=" + this.pointNumBytes + " to inconsistent dimensionCount=" + dimensionCount +", indexDimensionCount=" + indexDimensionCount + ", numBytes=" + dimensionNumBytes);}if (this.indexOptions != IndexOptions.NONE) { // if updated field data is not for indexing, leave the updates out@@ -184,15 +184,15 @@ public final class FieldInfo {/** Record that this field is indexed with points, with the* specified number of dimensions and bytes per dimension. */- public void setPointDimensions(int dataDimensionCount, int indexDimensionCount, int numBytes) {- if (dataDimensionCount <= 0) {- throw new IllegalArgumentException("point data dimension count must be >= 0; got " + dataDimensionCount + " for field=\"" + name + "\"");+ public void setPointDimensions(int dimensionCount, int indexDimensionCount, int numBytes) {+ if (dimensionCount <= 0) {+ throw new IllegalArgumentException("point dimension count must be >= 0; got " + dimensionCount + " for field=\"" + name + "\"");}- if (dataDimensionCount > PointValues.MAX_DIMENSIONS) {- throw new IllegalArgumentException("point data dimension count must be < PointValues.MAX_DIMENSIONS (= " + PointValues.MAX_DIMENSIONS + "); got " + dataDimensionCount + " for field=\"" + name + "\"");+ if (indexDimensionCount > PointValues.MAX_INDEX_DIMENSIONS) {+ throw new IllegalArgumentException("point index dimension count must be < PointValues.MAX_INDEX_DIMENSIONS (= " + PointValues.MAX_INDEX_DIMENSIONS + "); got " + indexDimensionCount + " for field=\"" + name + "\"");}- if (indexDimensionCount > dataDimensionCount) {- throw new IllegalArgumentException("point index dimension count must be <= point data dimension count (= " + dataDimensionCount + "); got " + indexDimensionCount + " for field=\"" + name + "\"");+ if (indexDimensionCount > dimensionCount) {+ throw new IllegalArgumentException("point index dimension count must be <= point dimension count (= " + dimensionCount + "); got " + indexDimensionCount + " for field=\"" + name + "\"");}if (numBytes <= 0) {throw new IllegalArgumentException("point numBytes must be >= 0; got " + numBytes + " for field=\"" + name + "\"");@@ -200,8 +200,8 @@ public final class FieldInfo {if (numBytes > PointValues.MAX_NUM_BYTES) {throw new IllegalArgumentException("point numBytes must be <= PointValues.MAX_NUM_BYTES (= " + PointValues.MAX_NUM_BYTES + "); got " + numBytes + " for field=\"" + name + "\"");}- if (pointDataDimensionCount != 0 && pointDataDimensionCount != dataDimensionCount) {- throw new IllegalArgumentException("cannot change point data dimension count from " + pointDataDimensionCount + " to " + dataDimensionCount + " for field=\"" + name + "\"");+ if (pointDimensionCount != 0 && pointDimensionCount != dimensionCount) {+ throw new IllegalArgumentException("cannot change point dimension count from " + pointDimensionCount + " to " + dimensionCount + " for field=\"" + name + "\"");}if (pointIndexDimensionCount != 0 && pointIndexDimensionCount != indexDimensionCount) {throw new IllegalArgumentException("cannot change point index dimension count from " + pointIndexDimensionCount + " to " + indexDimensionCount + " for field=\"" + name + "\"");@@ -210,7 +210,7 @@ public final class FieldInfo {throw new IllegalArgumentException("cannot change point numBytes from " + pointNumBytes + " to " + numBytes + " for field=\"" + name + "\"");}- pointDataDimensionCount = dataDimensionCount;+ pointDimensionCount = dimensionCount;pointIndexDimensionCount = indexDimensionCount;pointNumBytes = numBytes;@@ -218,8 +218,8 @@ public final class FieldInfo {}/** Return point data dimension count */- public int getPointDataDimensionCount() {- return pointDataDimensionCount;+ public int getPointDimensionCount() {+ return pointDimensionCount;}/** Return point data dimension count */diff --git a/lucene/core/src/java/org/apache/lucene/index/FieldInfos.java b/lucene/core/src/java/org/apache/lucene/index/FieldInfos.javaindex 281c36d2795..4b266d008a2 100644--- a/lucene/core/src/java/org/apache/lucene/index/FieldInfos.java+++ b/lucene/core/src/java/org/apache/lucene/index/FieldInfos.java@@ -98,7 +98,7 @@ public class FieldInfos implements Iterable<FieldInfo> {hasNorms |= info.hasNorms();hasDocValues |= info.getDocValuesType() != DocValuesType.NONE;hasPayloads |= info.hasPayloads();- hasPointValues |= (info.getPointDataDimensionCount() != 0);+ hasPointValues |= (info.getPointDimensionCount() != 0);if (info.isSoftDeletesField()) {if (softDeletesField != null && softDeletesField.equals(info.name) == false) {throw new IllegalArgumentException("multiple soft-deletes fields [" + info.name + ", " + softDeletesField + "]");@@ -251,12 +251,12 @@ public class FieldInfos implements Iterable<FieldInfo> {}static final class FieldDimensions {- public final int dataDimensionCount;+ public final int dimensionCount;public final int indexDimensionCount;public final int dimensionNumBytes;- public FieldDimensions(int dataDimensionCount, int indexDimensionCount, int dimensionNumBytes) {- this.dataDimensionCount = dataDimensionCount;+ public FieldDimensions(int dimensionCount, int indexDimensionCount, int dimensionNumBytes) {+ this.dimensionCount = dimensionCount;this.indexDimensionCount = indexDimensionCount;this.dimensionNumBytes = dimensionNumBytes;}@@ -297,7 +297,7 @@ public class FieldInfos implements Iterable<FieldInfo> {* number assigned if possible otherwise the first unassigned field number* is used as the field number.*/- synchronized int addOrGet(String fieldName, int preferredFieldNumber, IndexOptions indexOptions, DocValuesType dvType, int dataDimensionCount, int indexDimensionCount, int dimensionNumBytes, boolean isSoftDeletesField) {+ synchronized int addOrGet(String fieldName, int preferredFieldNumber, IndexOptions indexOptions, DocValuesType dvType, int dimensionCount, int indexDimensionCount, int dimensionNumBytes, boolean isSoftDeletesField) {if (indexOptions != IndexOptions.NONE) {IndexOptions currentOpts = this.indexOptions.get(fieldName);if (currentOpts == null) {@@ -314,11 +314,11 @@ public class FieldInfos implements Iterable<FieldInfo> {throw new IllegalArgumentException("cannot change DocValues type from " + currentDVType + " to " + dvType + " for field \"" + fieldName + "\"");}}- if (dataDimensionCount != 0) {+ if (dimensionCount != 0) {FieldDimensions dims = dimensions.get(fieldName);if (dims != null) {- if (dims.dataDimensionCount != dataDimensionCount) {- throw new IllegalArgumentException("cannot change point data dimension count from " + dims.dataDimensionCount + " to " + dataDimensionCount + " for field=\"" + fieldName + "\"");+ if (dims.dimensionCount != dimensionCount) {+ throw new IllegalArgumentException("cannot change point dimension count from " + dims.dimensionCount + " to " + dimensionCount + " for field=\"" + fieldName + "\"");}if (dims.indexDimensionCount != indexDimensionCount) {throw new IllegalArgumentException("cannot change point index dimension count from " + dims.indexDimensionCount + " to " + indexDimensionCount + " for field=\"" + fieldName + "\"");@@ -327,7 +327,7 @@ public class FieldInfos implements Iterable<FieldInfo> {throw new IllegalArgumentException("cannot change point numBytes from " + dims.dimensionNumBytes + " to " + dimensionNumBytes + " for field=\"" + fieldName + "\"");}} else {- dimensions.put(fieldName, new FieldDimensions(dataDimensionCount, indexDimensionCount, dimensionNumBytes));+ dimensions.put(fieldName, new FieldDimensions(dimensionCount, indexDimensionCount, dimensionNumBytes));}}Integer fieldNumber = nameToNumber.get(fieldName);@@ -396,8 +396,8 @@ public class FieldInfos implements Iterable<FieldInfo> {}FieldDimensions dim = dimensions.get(name);if (dim != null) {- if (dim.dataDimensionCount != dataDimensionCount) {- throw new IllegalArgumentException("cannot change point data dimension count from " + dim.dataDimensionCount + " to " + dataDimensionCount + " for field=\"" + name + "\"");+ if (dim.dimensionCount != dataDimensionCount) {+ throw new IllegalArgumentException("cannot change point dimension count from " + dim.dimensionCount + " to " + dataDimensionCount + " for field=\"" + name + "\"");}if (dim.indexDimensionCount != indexDimensionCount) {throw new IllegalArgumentException("cannot change point index dimension count from " + dim.indexDimensionCount + " to " + indexDimensionCount + " for field=\"" + name + "\"");@@ -440,18 +440,21 @@ public class FieldInfos implements Iterable<FieldInfo> {docValuesType.put(name, dvType);}- synchronized void setDimensions(int number, String name, int dataDimensionCount, int indexDimensionCount, int dimensionNumBytes) {+ synchronized void setDimensions(int number, String name, int dimensionCount, int indexDimensionCount, int dimensionNumBytes) {+ if (dimensionCount > PointValues.MAX_DIMENSIONS) {+ throw new IllegalArgumentException("dimensionCount must be <= PointValues.MAX_DIMENSIONS (= " + PointValues.MAX_DIMENSIONS + "); got " + dimensionCount + " for field=\"" + name + "\"");+ }if (dimensionNumBytes > PointValues.MAX_NUM_BYTES) {throw new IllegalArgumentException("dimension numBytes must be <= PointValues.MAX_NUM_BYTES (= " + PointValues.MAX_NUM_BYTES + "); got " + dimensionNumBytes + " for field=\"" + name + "\"");}- if (dataDimensionCount > PointValues.MAX_DIMENSIONS) {- throw new IllegalArgumentException("pointDataDimensionCount must be <= PointValues.MAX_DIMENSIONS (= " + PointValues.MAX_DIMENSIONS + "); got " + dataDimensionCount + " for field=\"" + name + "\"");+ if (indexDimensionCount > dimensionCount) {+ throw new IllegalArgumentException("indexDimensionCount must be <= dimensionCount (= " + dimensionCount + "); got " + indexDimensionCount + " for field=\"" + name + "\"");}- if (indexDimensionCount > dataDimensionCount) {- throw new IllegalArgumentException("pointIndexDimensionCount must be <= pointDataDimensionCount (= " + dataDimensionCount + "); got " + indexDimensionCount + " for field=\"" + name + "\"");+ if (indexDimensionCount > PointValues.MAX_INDEX_DIMENSIONS) {+ throw new IllegalArgumentException("indexDimensionCount must be <= PointValues.MAX_INDEX_DIMENSIONS (= " + PointValues.MAX_INDEX_DIMENSIONS + "); got " + indexDimensionCount + " for field=\"" + name + "\"");}- verifyConsistentDimensions(number, name, dataDimensionCount, indexDimensionCount, dimensionNumBytes);- dimensions.put(name, new FieldDimensions(dataDimensionCount, indexDimensionCount, dimensionNumBytes));+ verifyConsistentDimensions(number, name, dimensionCount, indexDimensionCount, dimensionNumBytes);+ dimensions.put(name, new FieldDimensions(dimensionCount, indexDimensionCount, dimensionNumBytes));}}@@ -554,7 +557,7 @@ public class FieldInfos implements Iterable<FieldInfo> {fi.omitsNorms(), fi.hasPayloads(),fi.getIndexOptions(), fi.getDocValuesType(), dvGen,fi.attributes(),- fi.getPointDataDimensionCount(), fi.getPointIndexDimensionCount(), fi.getPointNumBytes(),+ fi.getPointDimensionCount(), fi.getPointIndexDimensionCount(), fi.getPointNumBytes(),fi.isSoftDeletesField());}diff --git a/lucene/core/src/java/org/apache/lucene/index/IndexWriter.java b/lucene/core/src/java/org/apache/lucene/index/IndexWriter.javaindex 9652fca58ee..81551799f5b 100644--- a/lucene/core/src/java/org/apache/lucene/index/IndexWriter.java+++ b/lucene/core/src/java/org/apache/lucene/index/IndexWriter.java@@ -992,7 +992,7 @@ public class IndexWriter implements Closeable, TwoPhaseCommit, Accountable,for(SegmentCommitInfo info : segmentInfos) {FieldInfos fis = readFieldInfos(info);for(FieldInfo fi : fis) {- map.addOrGet(fi.name, fi.number, fi.getIndexOptions(), fi.getDocValuesType(), fi.getPointDataDimensionCount(), fi.getPointIndexDimensionCount(), fi.getPointNumBytes(), fi.isSoftDeletesField());+ map.addOrGet(fi.name, fi.number, fi.getIndexOptions(), fi.getDocValuesType(), fi.getPointDimensionCount(), fi.getPointIndexDimensionCount(), fi.getPointNumBytes(), fi.isSoftDeletesField());}}@@ -2814,7 +2814,7 @@ public class IndexWriter implements Closeable, TwoPhaseCommit, Accountable,FieldInfos fis = readFieldInfos(info);for(FieldInfo fi : fis) {// This will throw exceptions if any of the incoming fields have an illegal schema change:- globalFieldNumberMap.addOrGet(fi.name, fi.number, fi.getIndexOptions(), fi.getDocValuesType(), fi.getPointDataDimensionCount(), fi.getPointIndexDimensionCount(), fi.getPointNumBytes(), fi.isSoftDeletesField());+ globalFieldNumberMap.addOrGet(fi.name, fi.number, fi.getIndexOptions(), fi.getDocValuesType(), fi.getPointDimensionCount(), fi.getPointIndexDimensionCount(), fi.getPointNumBytes(), fi.isSoftDeletesField());}infos.add(copySegmentAsIs(info, newSegName, context));}diff --git a/lucene/core/src/java/org/apache/lucene/index/IndexableFieldType.java b/lucene/core/src/java/org/apache/lucene/index/IndexableFieldType.javaindex 59c5ab5192b..9eb7a1574dd 100644--- a/lucene/core/src/java/org/apache/lucene/index/IndexableFieldType.java+++ b/lucene/core/src/java/org/apache/lucene/index/IndexableFieldType.java@@ -100,9 +100,9 @@ public interface IndexableFieldType {public DocValuesType docValuesType();/**- * If this is positive (representing the number of point data dimensions), the field is indexed as a point.+ * If this is positive (representing the number of point dimensions), the field is indexed as a point.*/- public int pointDataDimensionCount();+ public int pointDimensionCount();/*** The number of dimensions used for the index keydiff --git a/lucene/core/src/java/org/apache/lucene/index/PointValues.java b/lucene/core/src/java/org/apache/lucene/index/PointValues.javaindex 5406d60bc90..130734a87a5 100644--- a/lucene/core/src/java/org/apache/lucene/index/PointValues.java+++ b/lucene/core/src/java/org/apache/lucene/index/PointValues.java@@ -89,6 +89,9 @@ public abstract class PointValues {/** Maximum number of dimensions */public static final int MAX_DIMENSIONS = BKDWriter.MAX_DIMS;+ /** Maximum number of index dimensions */+ public static final int MAX_INDEX_DIMENSIONS = BKDWriter.MAX_INDEX_DIMS;+/** Return the cumulated number of points across all leaves of the given* {@link IndexReader}. Leaves that do not have points for the given field* are ignored.@@ -270,8 +273,8 @@ public abstract class PointValues {/** Returns maximum value for each dimension, packed, or null if {@link #size} is <code>0</code> */public abstract byte[] getMaxPackedValue() throws IOException;- /** Returns how many data dimensions are represented in the values */- public abstract int getNumDataDimensions() throws IOException;+ /** Returns how many dimensions are represented in the values */+ public abstract int getNumDimensions() throws IOException;/** Returns how many dimensions are used for the index */public abstract int getNumIndexDimensions() throws IOException;diff --git a/lucene/core/src/java/org/apache/lucene/index/PointValuesWriter.java b/lucene/core/src/java/org/apache/lucene/index/PointValuesWriter.javaindex eb11ec3c807..dd99393ee66 100644--- a/lucene/core/src/java/org/apache/lucene/index/PointValuesWriter.java+++ b/lucene/core/src/java/org/apache/lucene/index/PointValuesWriter.java@@ -43,7 +43,7 @@ class PointValuesWriter {this.bytes = new ByteBlockPool(docWriter.byteBlockAllocator);docIDs = new int[16];iwBytesUsed.addAndGet(16 * Integer.BYTES);- packedBytesLength = fieldInfo.getPointDataDimensionCount() * fieldInfo.getPointNumBytes();+ packedBytesLength = fieldInfo.getPointDimensionCount() * fieldInfo.getPointNumBytes();}// TODO: if exactly the same value is added to exactly the same doc, should we dedup?@@ -52,7 +52,7 @@ class PointValuesWriter {throw new IllegalArgumentException("field=" + fieldInfo.name + ": point value must not be null");}if (value.length != packedBytesLength) {- throw new IllegalArgumentException("field=" + fieldInfo.name + ": this field's value has length=" + value.length + " but should be " + (fieldInfo.getPointDataDimensionCount() * fieldInfo.getPointNumBytes()));+ throw new IllegalArgumentException("field=" + fieldInfo.name + ": this field's value has length=" + value.length + " but should be " + (fieldInfo.getPointDimensionCount() * fieldInfo.getPointNumBytes()));}if (docIDs.length == numPoints) {@@ -106,7 +106,7 @@ class PointValuesWriter {}@Override- public int getNumDataDimensions() {+ public int getNumDimensions() {throw new UnsupportedOperationException();}@@ -234,8 +234,8 @@ class PointValuesWriter {}@Override- public int getNumDataDimensions() throws IOException {- return in.getNumDataDimensions();+ public int getNumDimensions() throws IOException {+ return in.getNumDimensions();}@Overridediff --git a/lucene/core/src/java/org/apache/lucene/index/SortingLeafReader.java b/lucene/core/src/java/org/apache/lucene/index/SortingLeafReader.javaindex 104ef06a80c..7ec56964fb0 100644--- a/lucene/core/src/java/org/apache/lucene/index/SortingLeafReader.java+++ b/lucene/core/src/java/org/apache/lucene/index/SortingLeafReader.java@@ -342,8 +342,8 @@ class SortingLeafReader extends FilterLeafReader {}@Override- public int getNumDataDimensions() throws IOException {- return in.getNumDataDimensions();+ public int getNumDimensions() throws IOException {+ return in.getNumDimensions();}@Overridediff --git a/lucene/core/src/java/org/apache/lucene/search/PointInSetQuery.java b/lucene/core/src/java/org/apache/lucene/search/PointInSetQuery.javaindex 58bef6cbb9f..e8f3cc773aa 100644--- a/lucene/core/src/java/org/apache/lucene/search/PointInSetQuery.java+++ b/lucene/core/src/java/org/apache/lucene/search/PointInSetQuery.java@@ -77,8 +77,8 @@ public abstract class PointInSetQuery extends Query implements Accountable {throw new IllegalArgumentException("bytesPerDim must be > 0 and <= " + PointValues.MAX_NUM_BYTES + "; got " + bytesPerDim);}this.bytesPerDim = bytesPerDim;- if (numDims < 1 || numDims > PointValues.MAX_DIMENSIONS) {- throw new IllegalArgumentException("numDims must be > 0 and <= " + PointValues.MAX_DIMENSIONS + "; got " + numDims);+ if (numDims < 1 || numDims > PointValues.MAX_INDEX_DIMENSIONS) {+ throw new IllegalArgumentException("numDims must be > 0 and <= " + PointValues.MAX_INDEX_DIMENSIONS + "; got " + numDims);}this.numDims = numDims;diff --git a/lucene/core/src/java/org/apache/lucene/util/bkd/BKDReader.java b/lucene/core/src/java/org/apache/lucene/util/bkd/BKDReader.javaindex ff7bf3b373d..490432693ef 100644--- a/lucene/core/src/java/org/apache/lucene/util/bkd/BKDReader.java+++ b/lucene/core/src/java/org/apache/lucene/util/bkd/BKDReader.java@@ -896,7 +896,7 @@ public final class BKDReader extends PointValues implements Accountable {}@Override- public int getNumDataDimensions() {+ public int getNumDimensions() {return numDataDims;}diff --git a/lucene/core/src/java/org/apache/lucene/util/bkd/BKDWriter.java b/lucene/core/src/java/org/apache/lucene/util/bkd/BKDWriter.javaindex f0183fa4ea4..727b824f721 100644--- a/lucene/core/src/java/org/apache/lucene/util/bkd/BKDWriter.java+++ b/lucene/core/src/java/org/apache/lucene/util/bkd/BKDWriter.java@@ -92,8 +92,11 @@ public class BKDWriter implements Closeable {/** Default maximum heap to use, before spilling to (slower) disk */public static final float DEFAULT_MAX_MB_SORT_IN_HEAP = 16.0f;- /** Maximum number of dimensions */- public static final int MAX_DIMS = 8;+ /** Maximum number of index dimensions (2 * max index dimensions) */+ public static final int MAX_DIMS = 16;++ /** Maximum number of index dimensions */+ public static final int MAX_INDEX_DIMS = 8;/** Number of splits before we compute the exact bounding box of an inner node. */private static final int SPLITS_BEFORE_EXACT_BOUNDS = 4;@@ -185,14 +188,17 @@ public class BKDWriter implements Closeable {this.maxMBSortInHeap = maxMBSortInHeap;}- public static void verifyParams(int numDataDims, int numIndexDims, int maxPointsInLeafNode, double maxMBSortInHeap, long totalPointCount) {+ public static void verifyParams(int numDims, int numIndexDims, int maxPointsInLeafNode, double maxMBSortInHeap, long totalPointCount) {// We encode dim in a single byte in the splitPackedValues, but we only expose 4 bits for it now, in case we want to use// remaining 4 bits for another purpose later- if (numDataDims < 1 || numDataDims > MAX_DIMS) {- throw new IllegalArgumentException("numDataDims must be 1 .. " + MAX_DIMS + " (got: " + numDataDims + ")");+ if (numDims < 1 || numDims > MAX_DIMS) {+ throw new IllegalArgumentException("numDims must be 1 .. " + MAX_DIMS + " (got: " + numDims + ")");+ }+ if (numIndexDims < 1 || numIndexDims > MAX_INDEX_DIMS) {+ throw new IllegalArgumentException("numIndexDims must be 1 .. " + MAX_INDEX_DIMS + " (got: " + numIndexDims + ")");}- if (numIndexDims < 1 || numIndexDims > numDataDims) {- throw new IllegalArgumentException("numIndexDims must be 1 .. " + numDataDims + " (got: " + numIndexDims + ")");+ if (numIndexDims > numDims) {+ throw new IllegalArgumentException("numIndexDims cannot exceed numDims (" + numDims + ") (got: " + numIndexDims + ")");}if (maxPointsInLeafNode <= 0) {throw new IllegalArgumentException("maxPointsInLeafNode must be > 0; got " + maxPointsInLeafNode);diff --git a/lucene/core/src/test/org/apache/lucene/codecs/lucene60/TestLucene60PointsFormat.java b/lucene/core/src/test/org/apache/lucene/codecs/lucene60/TestLucene60PointsFormat.javaindex 5f907b1d205..33c145f9ed1 100644--- a/lucene/core/src/test/org/apache/lucene/codecs/lucene60/TestLucene60PointsFormat.java+++ b/lucene/core/src/test/org/apache/lucene/codecs/lucene60/TestLucene60PointsFormat.java@@ -372,7 +372,7 @@ public class TestLucene60PointsFormat extends BasePointsFormatTestCase {}@Override- public int getNumDataDimensions() throws IOException {+ public int getNumDimensions() throws IOException {throw new UnsupportedOperationException();}diff --git a/lucene/core/src/test/org/apache/lucene/document/TestFieldType.java b/lucene/core/src/test/org/apache/lucene/document/TestFieldType.javaindex 8237a4f4be8..f244aa5cee8 100644--- a/lucene/core/src/test/org/apache/lucene/document/TestFieldType.java+++ b/lucene/core/src/test/org/apache/lucene/document/TestFieldType.java@@ -69,7 +69,7 @@ public class TestFieldType extends LuceneTestCase {public void testPointsToString() {FieldType ft = new FieldType();ft.setDimensions(1, Integer.BYTES);- assertEquals("pointDataDimensionCount=1,pointIndexDimensionCount=1,pointNumBytes=4", ft.toString());+ assertEquals("pointDimensionCount=1,pointIndexDimensionCount=1,pointNumBytes=4", ft.toString());}/**@@ -114,11 +114,11 @@ public class TestFieldType extends LuceneTestCase {final Class<?>[] parameterTypes = method.getParameterTypes();final Object[] args = new Object[parameterTypes.length];if (method.equals(setDimensionsMethodA)) {- args[0] = 1 + random().nextInt(PointValues.MAX_DIMENSIONS);+ args[0] = 1 + random().nextInt(PointValues.MAX_INDEX_DIMENSIONS);args[1] = 1 + random().nextInt(PointValues.MAX_NUM_BYTES);} else if (method.equals(setDimensionsMethodB)) {args[0] = 1 + random().nextInt(PointValues.MAX_DIMENSIONS);- args[1] = 1 + random().nextInt((Integer)args[0]);+ args[1] = 1 + Math.min((Integer)args[0] - 1, random().nextInt(PointValues.MAX_INDEX_DIMENSIONS));args[2] = 1 + random().nextInt(PointValues.MAX_NUM_BYTES);} else {for (int i = 0; i < args.length; ++i) {diff --git a/lucene/core/src/test/org/apache/lucene/index/TestIndexableField.java b/lucene/core/src/test/org/apache/lucene/index/TestIndexableField.javaindex 991807abbb2..f71d6a28716 100644--- a/lucene/core/src/test/org/apache/lucene/index/TestIndexableField.java+++ b/lucene/core/src/test/org/apache/lucene/index/TestIndexableField.java@@ -92,7 +92,7 @@ public class TestIndexableField extends LuceneTestCase {}@Override- public int pointDataDimensionCount() {+ public int pointDimensionCount() {return 0;}diff --git a/lucene/core/src/test/org/apache/lucene/index/TestPointValues.java b/lucene/core/src/test/org/apache/lucene/index/TestPointValues.javaindex e5cd4aecaee..ee778ed9002 100644--- a/lucene/core/src/test/org/apache/lucene/index/TestPointValues.java+++ b/lucene/core/src/test/org/apache/lucene/index/TestPointValues.java@@ -72,7 +72,7 @@ public class TestPointValues extends LuceneTestCase {IllegalArgumentException expected = expectThrows(IllegalArgumentException.class, () -> {w.addDocument(doc);});- assertEquals("cannot change point data dimension count from 1 to 2 for field=\"dim\"", expected.getMessage());+ assertEquals("cannot change point dimension count from 1 to 2 for field=\"dim\"", expected.getMessage());w.close();dir.close();}@@ -90,7 +90,7 @@ public class TestPointValues extends LuceneTestCase {IllegalArgumentException expected = expectThrows(IllegalArgumentException.class, () -> {w.addDocument(doc2);});- assertEquals("cannot change point data dimension count from 1 to 2 for field=\"dim\"", expected.getMessage());+ assertEquals("cannot change point dimension count from 1 to 2 for field=\"dim\"", expected.getMessage());w.close();dir.close();@@ -110,7 +110,7 @@ public class TestPointValues extends LuceneTestCase {IllegalArgumentException expected = expectThrows(IllegalArgumentException.class, () -> {w.addDocument(doc2);});- assertEquals("cannot change point data dimension count from 1 to 2 for field=\"dim\"", expected.getMessage());+ assertEquals("cannot change point dimension count from 1 to 2 for field=\"dim\"", expected.getMessage());w.close();dir.close();@@ -132,7 +132,7 @@ public class TestPointValues extends LuceneTestCase {IllegalArgumentException expected = expectThrows(IllegalArgumentException.class, () -> {w2.addDocument(doc2);});- assertEquals("cannot change point data dimension count from 1 to 2 for field=\"dim\"", expected.getMessage());+ assertEquals("cannot change point dimension count from 1 to 2 for field=\"dim\"", expected.getMessage());w2.close();dir.close();@@ -155,7 +155,7 @@ public class TestPointValues extends LuceneTestCase {IllegalArgumentException expected = expectThrows(IllegalArgumentException.class, () -> {w2.addIndexes(new Directory[] {dir});});- assertEquals("cannot change point data dimension count from 2 to 1 for field=\"dim\"", expected.getMessage());+ assertEquals("cannot change point dimension count from 2 to 1 for field=\"dim\"", expected.getMessage());IOUtils.close(w2, dir, dir2);}@@ -178,7 +178,7 @@ public class TestPointValues extends LuceneTestCase {IllegalArgumentException expected = expectThrows(IllegalArgumentException.class, () -> {w2.addIndexes(new CodecReader[] {(CodecReader) getOnlyLeafReader(r)});});- assertEquals("cannot change point data dimension count from 2 to 1 for field=\"dim\"", expected.getMessage());+ assertEquals("cannot change point dimension count from 2 to 1 for field=\"dim\"", expected.getMessage());IOUtils.close(r, w2, dir, dir2);}@@ -202,7 +202,7 @@ public class TestPointValues extends LuceneTestCase {IllegalArgumentException expected = expectThrows(IllegalArgumentException.class, () -> {TestUtil.addIndexesSlowly(w2, r);});- assertEquals("cannot change point data dimension count from 2 to 1 for field=\"dim\"", expected.getMessage());+ assertEquals("cannot change point dimension count from 2 to 1 for field=\"dim\"", expected.getMessage());IOUtils.close(r, w2, dir, dir2);}@@ -377,7 +377,7 @@ public class TestPointValues extends LuceneTestCase {IndexWriterConfig iwc = new IndexWriterConfig(new MockAnalyzer(random()));IndexWriter w = new IndexWriter(dir, iwc);Document doc = new Document();- byte[][] values = new byte[PointValues.MAX_DIMENSIONS+1][];+ byte[][] values = new byte[PointValues.MAX_INDEX_DIMENSIONS +1][];for(int i=0;i<values.length;i++) {values[i] = new byte[4];}diff --git a/lucene/core/src/test/org/apache/lucene/search/TestPointQueries.java b/lucene/core/src/test/org/apache/lucene/search/TestPointQueries.javaindex 3b52f2c47d6..3c6e29403e5 100644--- a/lucene/core/src/test/org/apache/lucene/search/TestPointQueries.java+++ b/lucene/core/src/test/org/apache/lucene/search/TestPointQueries.java@@ -608,7 +608,7 @@ public class TestPointQueries extends LuceneTestCase {private void doTestRandomBinary(int count) throws Exception {int numValues = TestUtil.nextInt(random(), count, count*2);int numBytesPerDim = TestUtil.nextInt(random(), 2, PointValues.MAX_NUM_BYTES);- int numDims = TestUtil.nextInt(random(), 1, PointValues.MAX_DIMENSIONS);+ int numDims = TestUtil.nextInt(random(), 1, PointValues.MAX_INDEX_DIMENSIONS);int sameValuePct = random().nextInt(100);if (VERBOSE) {diff --git a/lucene/core/src/test/org/apache/lucene/util/TestDocIdSetBuilder.java b/lucene/core/src/test/org/apache/lucene/util/TestDocIdSetBuilder.javaindex bde127ce7d3..69c51d47bdd 100644--- a/lucene/core/src/test/org/apache/lucene/util/TestDocIdSetBuilder.java+++ b/lucene/core/src/test/org/apache/lucene/util/TestDocIdSetBuilder.java@@ -327,7 +327,7 @@ public class TestDocIdSetBuilder extends LuceneTestCase {}@Override- public int getNumDataDimensions() throws IOException {+ public int getNumDimensions() throws IOException {throw new UnsupportedOperationException();}diff --git a/lucene/core/src/test/org/apache/lucene/util/bkd/TestBKD.java b/lucene/core/src/test/org/apache/lucene/util/bkd/TestBKD.javaindex 8f05b4a0246..38d91f20f9b 100644--- a/lucene/core/src/test/org/apache/lucene/util/bkd/TestBKD.java+++ b/lucene/core/src/test/org/apache/lucene/util/bkd/TestBKD.java@@ -385,8 +385,8 @@ public class TestBKD extends LuceneTestCase {public void testWithExceptions() throws Exception {int numDocs = atLeast(10000);int numBytesPerDim = TestUtil.nextInt(random(), 2, 30);- int numDataDims = TestUtil.nextInt(random(), 1, 5);- int numIndexDims = TestUtil.nextInt(random(), 1, numDataDims);+ int numDataDims = TestUtil.nextInt(random(), 1, PointValues.MAX_DIMENSIONS);+ int numIndexDims = Math.min(TestUtil.nextInt(random(), 1, numDataDims), PointValues.MAX_INDEX_DIMENSIONS);byte[][][] docValues = new byte[numDocs][][];@@ -455,8 +455,8 @@ public class TestBKD extends LuceneTestCase {int numDocs = TestUtil.nextInt(random(), count, count*2);int numBytesPerDim = TestUtil.nextInt(random(), 2, 30);- int numDataDims = TestUtil.nextInt(random(), 1, 5);- int numIndexDims = TestUtil.nextInt(random(), 1, numDataDims);+ int numDataDims = TestUtil.nextInt(random(), 1, PointValues.MAX_DIMENSIONS);+ int numIndexDims = Math.min(TestUtil.nextInt(random(), 1, numDataDims), PointValues.MAX_INDEX_DIMENSIONS);byte[][][] docValues = new byte[numDocs][][];@@ -474,8 +474,8 @@ public class TestBKD extends LuceneTestCase {public void testAllEqual() throws Exception {int numBytesPerDim = TestUtil.nextInt(random(), 2, 30);- int numDataDims = TestUtil.nextInt(random(), 1, 5);- int numIndexDims = TestUtil.nextInt(random(), 1, numDataDims);+ int numDataDims = TestUtil.nextInt(random(), 1, PointValues.MAX_DIMENSIONS);+ int numIndexDims = Math.min(TestUtil.nextInt(random(), 1, numDataDims), PointValues.MAX_INDEX_DIMENSIONS);int numDocs = atLeast(1000);byte[][][] docValues = new byte[numDocs][][];@@ -498,8 +498,8 @@ public class TestBKD extends LuceneTestCase {public void testIndexDimEqualDataDimDifferent() throws Exception {int numBytesPerDim = TestUtil.nextInt(random(), 2, 30);- int numDataDims = TestUtil.nextInt(random(), 2, 5);- int numIndexDims = TestUtil.nextInt(random(), 1, numDataDims - 1);+ int numDataDims = TestUtil.nextInt(random(), 2, PointValues.MAX_DIMENSIONS);+ int numIndexDims = Math.min(TestUtil.nextInt(random(), 1, numDataDims - 1), PointValues.MAX_INDEX_DIMENSIONS);int numDocs = atLeast(1000);byte[][][] docValues = new byte[numDocs][][];@@ -527,8 +527,8 @@ public class TestBKD extends LuceneTestCase {public void testOneDimEqual() throws Exception {int numBytesPerDim = TestUtil.nextInt(random(), 2, 30);- int numDataDims = TestUtil.nextInt(random(), 1, 5);- int numIndexDims = TestUtil.nextInt(random(), 1, numDataDims);+ int numDataDims = TestUtil.nextInt(random(), 1, PointValues.MAX_DIMENSIONS);+ int numIndexDims = Math.min(TestUtil.nextInt(random(), 1, numDataDims), PointValues.MAX_INDEX_DIMENSIONS);int numDocs = atLeast(1000);int theEqualDim = random().nextInt(numDataDims);@@ -554,8 +554,8 @@ public class TestBKD extends LuceneTestCase {// by looking at how many times each dim has been splitpublic void testOneDimLowCard() throws Exception {int numBytesPerDim = TestUtil.nextInt(random(), 2, 30);- int numDataDims = TestUtil.nextInt(random(), 2, 5);- int numIndexDims = TestUtil.nextInt(random(), 2, numDataDims);+ int numDataDims = TestUtil.nextInt(random(), 2, PointValues.MAX_DIMENSIONS);+ int numIndexDims = Math.min(TestUtil.nextInt(random(), 2, numDataDims), PointValues.MAX_INDEX_DIMENSIONS);int numDocs = atLeast(10000);int theLowCardDim = random().nextInt(numDataDims);@@ -591,8 +591,8 @@ public class TestBKD extends LuceneTestCase {// this should trigger run-length compression with lengths that are greater than 255public void testOneDimTwoValues() throws Exception {int numBytesPerDim = TestUtil.nextInt(random(), 2, 30);- int numDataDims = TestUtil.nextInt(random(), 1, 5);- int numIndexDims = TestUtil.nextInt(random(), 1, numDataDims);+ int numDataDims = TestUtil.nextInt(random(), 1, PointValues.MAX_DIMENSIONS);+ int numIndexDims = Math.min(TestUtil.nextInt(random(), 1, numDataDims), PointValues.MAX_INDEX_DIMENSIONS);int numDocs = atLeast(1000);int theDim = random().nextInt(numDataDims);@@ -621,8 +621,8 @@ public class TestBKD extends LuceneTestCase {// this should trigger low cardinality leavespublic void testRandomFewDifferentValues() throws Exception {int numBytesPerDim = TestUtil.nextInt(random(), 2, 30);- int numIndexDims = TestUtil.nextInt(random(), 1, 8);- int numDataDims = TestUtil.nextInt(random(), numIndexDims, 8);+ int numDataDims = TestUtil.nextInt(random(), 1, PointValues.MAX_DIMENSIONS);+ int numIndexDims = Math.min(TestUtil.nextInt(random(), 1, numDataDims), PointValues.MAX_INDEX_DIMENSIONS);int numDocs = atLeast(10000);int cardinality = TestUtil.nextInt(random(), 2, 100);@@ -643,8 +643,8 @@ public class TestBKD extends LuceneTestCase {public void testMultiValued() throws Exception {int numBytesPerDim = TestUtil.nextInt(random(), 2, 30);- int numDataDims = TestUtil.nextInt(random(), 1, 5);- int numIndexDims = TestUtil.nextInt(random(), 1, numDataDims);+ int numDataDims = TestUtil.nextInt(random(), 1, PointValues.MAX_DIMENSIONS);+ int numIndexDims = Math.min(TestUtil.nextInt(random(), 1, numDataDims), PointValues.MAX_INDEX_DIMENSIONS);int numDocs = atLeast(1000);List<byte[][]> docValues = new ArrayList<>();@@ -1222,7 +1222,7 @@ public class TestBKD extends LuceneTestCase {// values as a LongPoint:public void testWastedLeadingBytes() throws Exception {Random random = random();- int numDims = TestUtil.nextInt(random, 1, PointValues.MAX_DIMENSIONS);+ int numDims = TestUtil.nextInt(random, 1, PointValues.MAX_INDEX_DIMENSIONS);int numIndexDims = TestUtil.nextInt(random, 1, numDims);int bytesPerDim = PointValues.MAX_NUM_BYTES;int bytesUsed = TestUtil.nextInt(random, 1, 3);@@ -1403,7 +1403,7 @@ public class TestBKD extends LuceneTestCase {}@Override- public int getNumDataDimensions() {+ public int getNumDimensions() {throw new UnsupportedOperationException();}@@ -1538,7 +1538,7 @@ public class TestBKD extends LuceneTestCase {}@Override- public int getNumDataDimensions() {+ public int getNumDimensions() {return 1;}diff --git a/lucene/core/src/test/org/apache/lucene/util/bkd/TestMutablePointsReaderUtils.java b/lucene/core/src/test/org/apache/lucene/util/bkd/TestMutablePointsReaderUtils.javaindex e17eab1f9a2..f55be6f6539 100644--- a/lucene/core/src/test/org/apache/lucene/util/bkd/TestMutablePointsReaderUtils.java+++ b/lucene/core/src/test/org/apache/lucene/util/bkd/TestMutablePointsReaderUtils.java@@ -270,7 +270,7 @@ public class TestMutablePointsReaderUtils extends LuceneTestCase {}@Override- public int getNumDataDimensions() throws IOException {+ public int getNumDimensions() throws IOException {throw new UnsupportedOperationException();}diff --git a/lucene/join/src/java/org/apache/lucene/search/join/PointInSetIncludingScoreQuery.java b/lucene/join/src/java/org/apache/lucene/search/join/PointInSetIncludingScoreQuery.javaindex fc6b4ff44be..ce499f6aad6 100644--- a/lucene/join/src/java/org/apache/lucene/search/join/PointInSetIncludingScoreQuery.java+++ b/lucene/join/src/java/org/apache/lucene/search/join/PointInSetIncludingScoreQuery.java@@ -158,8 +158,8 @@ abstract class PointInSetIncludingScoreQuery extends Query implements Accountablif (fieldInfo == null) {return null;}- if (fieldInfo.getPointDataDimensionCount() != 1) {- throw new IllegalArgumentException("field=\"" + field + "\" was indexed with numDims=" + fieldInfo.getPointDataDimensionCount() + " but this query has numDims=1");+ if (fieldInfo.getPointDimensionCount() != 1) {+ throw new IllegalArgumentException("field=\"" + field + "\" was indexed with numDims=" + fieldInfo.getPointDimensionCount() + " but this query has numDims=1");}if (fieldInfo.getPointNumBytes() != bytesPerDim) {throw new IllegalArgumentException("field=\"" + field + "\" was indexed with bytesPerDim=" + fieldInfo.getPointNumBytes() + " but this query has bytesPerDim=" + bytesPerDim);diff --git a/lucene/luke/src/java/org/apache/lucene/luke/app/desktop/components/dialog/documents/IndexOptionsDialogFactory.java b/lucene/luke/src/java/org/apache/lucene/luke/app/desktop/components/dialog/documents/IndexOptionsDialogFactory.javaindex a0bda9cd973..5366e2d4e00 100644--- a/lucene/luke/src/java/org/apache/lucene/luke/app/desktop/components/dialog/documents/IndexOptionsDialogFactory.java+++ b/lucene/luke/src/java/org/apache/lucene/luke/app/desktop/components/dialog/documents/IndexOptionsDialogFactory.java@@ -246,7 +246,7 @@ public final class IndexOptionsDialogFactory implements DialogOpener.DialogFactostoreTVOffCB.setSelected(fieldType.storeTermVectorOffsets());storeTVPayCB.setSelected(fieldType.storeTermVectorPayloads());dvTypeCombo.setSelectedItem(fieldType.docValuesType().name());- dimCountTF.setText(String.valueOf(fieldType.pointDataDimensionCount()));+ dimCountTF.setText(String.valueOf(fieldType.pointDimensionCount()));dimNumBytesTF.setText(String.valueOf(fieldType.pointNumBytes()));if (nf.getType().equals(org.apache.lucene.document.TextField.class) ||diff --git a/lucene/luke/src/java/org/apache/lucene/luke/models/documents/DocumentField.java b/lucene/luke/src/java/org/apache/lucene/luke/models/documents/DocumentField.javaindex 5c18d3054e9..44737a35b22 100644--- a/lucene/luke/src/java/org/apache/lucene/luke/models/documents/DocumentField.java+++ b/lucene/luke/src/java/org/apache/lucene/luke/models/documents/DocumentField.java@@ -85,7 +85,7 @@ public final class DocumentField {dfield.dvType = finfo.getDocValuesType();- dfield.pointDimensionCount = finfo.getPointDataDimensionCount();+ dfield.pointDimensionCount = finfo.getPointDimensionCount();dfield.pointNumBytes = finfo.getPointNumBytes();if (field != null) {diff --git a/lucene/luke/src/java/org/apache/lucene/luke/models/search/SearchImpl.java b/lucene/luke/src/java/org/apache/lucene/luke/models/search/SearchImpl.javaindex fa283d46862..38c4b2146ab 100644--- a/lucene/luke/src/java/org/apache/lucene/luke/models/search/SearchImpl.java+++ b/lucene/luke/src/java/org/apache/lucene/luke/models/search/SearchImpl.java@@ -123,7 +123,7 @@ public final class SearchImpl extends LukeModel implements Search {public Collection<String> getRangeSearchableFieldNames() {return IndexUtils.getFieldNames(reader).stream().map(f -> IndexUtils.getFieldInfo(reader, f))- .filter(info -> info.getPointDataDimensionCount() > 0)+ .filter(info -> info.getPointDimensionCount() > 0).map(info -> info.name).collect(Collectors.toSet());}diff --git a/lucene/memory/src/java/org/apache/lucene/index/memory/MemoryIndex.java b/lucene/memory/src/java/org/apache/lucene/index/memory/MemoryIndex.javaindex ca9ccd75fa8..dacee10ab44 100644--- a/lucene/memory/src/java/org/apache/lucene/index/memory/MemoryIndex.java+++ b/lucene/memory/src/java/org/apache/lucene/index/memory/MemoryIndex.java@@ -410,7 +410,7 @@ public class MemoryIndex {storeDocValues(info, docValuesType, docValuesValue);}- if (field.fieldType().pointDataDimensionCount() > 0) {+ if (field.fieldType().pointDimensionCount() > 0) {storePointValues(info, field.binaryValue());}@@ -486,9 +486,9 @@ public class MemoryIndex {if (info == null) {fields.put(fieldName, info = new Info(createFieldInfo(fieldName, fields.size(), fieldType), byteBlockPool));}- if (fieldType.pointDataDimensionCount() != info.fieldInfo.getPointDataDimensionCount()) {- if (fieldType.pointDataDimensionCount() > 0)- info.fieldInfo.setPointDimensions(fieldType.pointDataDimensionCount(), fieldType.pointIndexDimensionCount(), fieldType.pointNumBytes());+ if (fieldType.pointDimensionCount() != info.fieldInfo.getPointDimensionCount()) {+ if (fieldType.pointDimensionCount() > 0)+ info.fieldInfo.setPointDimensions(fieldType.pointDimensionCount(), fieldType.pointIndexDimensionCount(), fieldType.pointNumBytes());}if (fieldType.docValuesType() != info.fieldInfo.getDocValuesType()) {if (fieldType.docValuesType() != DocValuesType.NONE)@@ -501,7 +501,7 @@ public class MemoryIndex {IndexOptions indexOptions = storeOffsets ? IndexOptions.DOCS_AND_FREQS_AND_POSITIONS_AND_OFFSETS : IndexOptions.DOCS_AND_FREQS_AND_POSITIONS;return new FieldInfo(fieldName, ord, fieldType.storeTermVectors(), fieldType.omitNorms(), storePayloads,indexOptions, fieldType.docValuesType(), -1, Collections.emptyMap(),- fieldType.pointDataDimensionCount(), fieldType.pointIndexDimensionCount(), fieldType.pointNumBytes(), false);+ fieldType.pointDimensionCount(), fieldType.pointIndexDimensionCount(), fieldType.pointNumBytes(), false);}private void storePointValues(Info info, BytesRef pointValue) {@@ -520,7 +520,7 @@ public class MemoryIndex {info.fieldInfo = new FieldInfo(info.fieldInfo.name, info.fieldInfo.number, info.fieldInfo.hasVectors(), info.fieldInfo.hasPayloads(),info.fieldInfo.hasPayloads(), info.fieldInfo.getIndexOptions(), docValuesType, -1, info.fieldInfo.attributes(),- info.fieldInfo.getPointDataDimensionCount(), info.fieldInfo.getPointIndexDimensionCount(), info.fieldInfo.getPointNumBytes(),+ info.fieldInfo.getPointDimensionCount(), info.fieldInfo.getPointIndexDimensionCount(), info.fieldInfo.getPointNumBytes(),info.fieldInfo.isSoftDeletesField());} else if (existingDocValuesType != docValuesType) {@@ -871,7 +871,7 @@ public class MemoryIndex {if (pointValues != null) {assert pointValues[0].bytes.length == pointValues[0].length : "BytesRef should wrap a precise byte[], BytesRef.deepCopyOf() should take care of this";- final int numDimensions = fieldInfo.getPointDataDimensionCount();+ final int numDimensions = fieldInfo.getPointDimensionCount();final int numBytesPerDimension = fieldInfo.getPointNumBytes();if (numDimensions == 1) {// PointInSetQuery.MergePointVisitor expects values to be visited in increasing order,@@ -1580,13 +1580,13 @@ public class MemoryIndex {}@Override- public int getNumDataDimensions() throws IOException {- return info.fieldInfo.getPointDataDimensionCount();+ public int getNumDimensions() throws IOException {+ return info.fieldInfo.getPointDimensionCount();}@Overridepublic int getNumIndexDimensions() throws IOException {- return info.fieldInfo.getPointDataDimensionCount();+ return info.fieldInfo.getPointDimensionCount();}@Overridediff --git a/lucene/sandbox/src/java/org/apache/lucene/document/BigIntegerPoint.java b/lucene/sandbox/src/java/org/apache/lucene/document/BigIntegerPoint.javaindex 82eeb3f15eb..4dc50d110f2 100644--- a/lucene/sandbox/src/java/org/apache/lucene/document/BigIntegerPoint.java+++ b/lucene/sandbox/src/java/org/apache/lucene/document/BigIntegerPoint.java@@ -62,8 +62,8 @@ public class BigIntegerPoint extends Field {/** Change the values of this field */public void setBigIntegerValues(BigInteger... point) {- if (type.pointDataDimensionCount() != point.length) {- throw new IllegalArgumentException("this field (name=" + name + ") uses " + type.pointDataDimensionCount() + " dimensions; cannot change to (incoming) " + point.length + " dimensions");+ if (type.pointDimensionCount() != point.length) {+ throw new IllegalArgumentException("this field (name=" + name + ") uses " + type.pointDimensionCount() + " dimensions; cannot change to (incoming) " + point.length + " dimensions");}fieldsData = pack(point);}@@ -75,8 +75,8 @@ public class BigIntegerPoint extends Field {@Overridepublic Number numericValue() {- if (type.pointDataDimensionCount() != 1) {- throw new IllegalStateException("this field (name=" + name + ") uses " + type.pointDataDimensionCount() + " dimensions; cannot convert to a single numeric value");+ if (type.pointDimensionCount() != 1) {+ throw new IllegalStateException("this field (name=" + name + ") uses " + type.pointDimensionCount() + " dimensions; cannot convert to a single numeric value");}BytesRef bytes = (BytesRef) fieldsData;assert bytes.length == BYTES;@@ -119,7 +119,7 @@ public class BigIntegerPoint extends Field {result.append(':');BytesRef bytes = (BytesRef) fieldsData;- for (int dim = 0; dim < type.pointDataDimensionCount(); dim++) {+ for (int dim = 0; dim < type.pointDimensionCount(); dim++) {if (dim > 0) {result.append(',');}diff --git a/lucene/sandbox/src/java/org/apache/lucene/document/HalfFloatPoint.java b/lucene/sandbox/src/java/org/apache/lucene/document/HalfFloatPoint.javaindex 15d82402f12..1f599a6f334 100644--- a/lucene/sandbox/src/java/org/apache/lucene/document/HalfFloatPoint.java+++ b/lucene/sandbox/src/java/org/apache/lucene/document/HalfFloatPoint.java@@ -213,8 +213,8 @@ public final class HalfFloatPoint extends Field {/** Change the values of this field */public void setFloatValues(float... point) {- if (type.pointDataDimensionCount() != point.length) {- throw new IllegalArgumentException("this field (name=" + name + ") uses " + type.pointDataDimensionCount() + " dimensions; cannot change to (incoming) " + point.length + " dimensions");+ if (type.pointDimensionCount() != point.length) {+ throw new IllegalArgumentException("this field (name=" + name + ") uses " + type.pointDimensionCount() + " dimensions; cannot change to (incoming) " + point.length + " dimensions");}fieldsData = pack(point);}@@ -226,8 +226,8 @@ public final class HalfFloatPoint extends Field {@Overridepublic Number numericValue() {- if (type.pointDataDimensionCount() != 1) {- throw new IllegalStateException("this field (name=" + name + ") uses " + type.pointDataDimensionCount() + " dimensions; cannot convert to a single numeric value");+ if (type.pointDimensionCount() != 1) {+ throw new IllegalStateException("this field (name=" + name + ") uses " + type.pointDimensionCount() + " dimensions; cannot convert to a single numeric value");}BytesRef bytes = (BytesRef) fieldsData;assert bytes.length == BYTES;@@ -270,7 +270,7 @@ public final class HalfFloatPoint extends Field {result.append(':');BytesRef bytes = (BytesRef) fieldsData;- for (int dim = 0; dim < type.pointDataDimensionCount(); dim++) {+ for (int dim = 0; dim < type.pointDimensionCount(); dim++) {if (dim > 0) {result.append(',');}diff --git a/lucene/sandbox/src/test/org/apache/lucene/document/TestFloatPointNearestNeighbor.java b/lucene/sandbox/src/test/org/apache/lucene/document/TestFloatPointNearestNeighbor.javaindex 93d7993d7a1..b2d5b03fbae 100644--- a/lucene/sandbox/src/test/org/apache/lucene/document/TestFloatPointNearestNeighbor.java+++ b/lucene/sandbox/src/test/org/apache/lucene/document/TestFloatPointNearestNeighbor.java@@ -144,7 +144,7 @@ public class TestFloatPointNearestNeighbor extends LuceneTestCase {iwc.setMergeScheduler(new SerialMergeScheduler());RandomIndexWriter w = new RandomIndexWriter(random(), dir, iwc);- int dims = TestUtil.nextInt(random(), 1, PointValues.MAX_DIMENSIONS);+ int dims = TestUtil.nextInt(random(), 1, PointValues.MAX_INDEX_DIMENSIONS);float[][] values = new float[numPoints][dims];for (int id = 0 ; id < numPoints ; ++id) {for (int dim = 0 ; dim < dims ; ++dim) {diff --git a/lucene/spatial-extras/src/java/org/apache/lucene/spatial/bbox/BBoxStrategy.java b/lucene/spatial-extras/src/java/org/apache/lucene/spatial/bbox/BBoxStrategy.javaindex 2cdef86cc83..5029d0e1b0f 100644--- a/lucene/spatial-extras/src/java/org/apache/lucene/spatial/bbox/BBoxStrategy.java+++ b/lucene/spatial-extras/src/java/org/apache/lucene/spatial/bbox/BBoxStrategy.java@@ -148,7 +148,7 @@ public class BBoxStrategy extends SpatialStrategy {if ((this.hasDocVals = fieldType.docValuesType() != DocValuesType.NONE)) {numQuads++;}- if ((this.hasPointVals = fieldType.pointDataDimensionCount() > 0)) {+ if ((this.hasPointVals = fieldType.pointDimensionCount() > 0)) {numQuads++;}diff --git a/lucene/spatial-extras/src/java/org/apache/lucene/spatial/vector/PointVectorStrategy.java b/lucene/spatial-extras/src/java/org/apache/lucene/spatial/vector/PointVectorStrategy.javaindex 6f2cb82050a..845c4b4992b 100644--- a/lucene/spatial-extras/src/java/org/apache/lucene/spatial/vector/PointVectorStrategy.java+++ b/lucene/spatial-extras/src/java/org/apache/lucene/spatial/vector/PointVectorStrategy.java@@ -140,7 +140,7 @@ public class PointVectorStrategy extends SpatialStrategy {if ((this.hasDocVals = fieldType.docValuesType() != DocValuesType.NONE)) {numPairs++;}- if ((this.hasPointVals = fieldType.pointDataDimensionCount() > 0)) {+ if ((this.hasPointVals = fieldType.pointDimensionCount() > 0)) {numPairs++;}this.fieldsLen = numPairs * 2;diff --git a/lucene/test-framework/src/java/org/apache/lucene/codecs/asserting/AssertingPointsFormat.java b/lucene/test-framework/src/java/org/apache/lucene/codecs/asserting/AssertingPointsFormat.javaindex 79dfa5f5b24..71709cc9b90 100644--- a/lucene/test-framework/src/java/org/apache/lucene/codecs/asserting/AssertingPointsFormat.java+++ b/lucene/test-framework/src/java/org/apache/lucene/codecs/asserting/AssertingPointsFormat.java@@ -138,8 +138,8 @@ public final class AssertingPointsFormat extends PointsFormat {@Overridepublic void writeField(FieldInfo fieldInfo, PointsReader values) throws IOException {- if (fieldInfo.getPointDataDimensionCount() == 0) {- throw new IllegalArgumentException("writing field=\"" + fieldInfo.name + "\" but pointDataDimensionalCount is 0");+ if (fieldInfo.getPointDimensionCount() == 0) {+ throw new IllegalArgumentException("writing field=\"" + fieldInfo.name + "\" but pointDimensionalCount is 0");}in.writeField(fieldInfo, values);}diff --git a/lucene/test-framework/src/java/org/apache/lucene/codecs/cranky/CrankyPointsFormat.java b/lucene/test-framework/src/java/org/apache/lucene/codecs/cranky/CrankyPointsFormat.javaindex 681edbdb477..9fc2c26787a 100644--- a/lucene/test-framework/src/java/org/apache/lucene/codecs/cranky/CrankyPointsFormat.java+++ b/lucene/test-framework/src/java/org/apache/lucene/codecs/cranky/CrankyPointsFormat.java@@ -155,11 +155,11 @@ class CrankyPointsFormat extends PointsFormat {}@Override- public int getNumDataDimensions() throws IOException {+ public int getNumDimensions() throws IOException {if (random.nextInt(100) == 0) {throw new IOException("Fake IOException");}- return delegate.getNumDataDimensions();+ return delegate.getNumDimensions();}@Overridediff --git a/lucene/test-framework/src/java/org/apache/lucene/index/AssertingLeafReader.java b/lucene/test-framework/src/java/org/apache/lucene/index/AssertingLeafReader.javaindex fe6024c5013..c7d15194427 100644--- a/lucene/test-framework/src/java/org/apache/lucene/index/AssertingLeafReader.java+++ b/lucene/test-framework/src/java/org/apache/lucene/index/AssertingLeafReader.java@@ -1049,7 +1049,7 @@ public class AssertingLeafReader extends FilterLeafReader {@Overridepublic void intersect(IntersectVisitor visitor) throws IOException {assertThread("Points", creationThread);- in.intersect(new AssertingIntersectVisitor(in.getNumDataDimensions(), in.getNumIndexDimensions(), in.getBytesPerDimension(), visitor));+ in.intersect(new AssertingIntersectVisitor(in.getNumDimensions(), in.getNumIndexDimensions(), in.getBytesPerDimension(), visitor));}@Override@@ -1073,9 +1073,9 @@ public class AssertingLeafReader extends FilterLeafReader {}@Override- public int getNumDataDimensions() throws IOException {+ public int getNumDimensions() throws IOException {assertThread("Points", creationThread);- return in.getNumDataDimensions();+ return in.getNumDimensions();}@Overridediff --git a/lucene/test-framework/src/java/org/apache/lucene/index/BaseIndexFileFormatTestCase.java b/lucene/test-framework/src/java/org/apache/lucene/index/BaseIndexFileFormatTestCase.javaindex 760b8ef885d..a0ad890ae2f 100644--- a/lucene/test-framework/src/java/org/apache/lucene/index/BaseIndexFileFormatTestCase.java+++ b/lucene/test-framework/src/java/org/apache/lucene/index/BaseIndexFileFormatTestCase.java@@ -347,7 +347,7 @@ abstract class BaseIndexFileFormatTestCase extends LuceneTestCase {FieldInfo proto = oneDocReader.getFieldInfos().fieldInfo("field");FieldInfo field = new FieldInfo(proto.name, proto.number, proto.hasVectors(), proto.omitsNorms(), proto.hasPayloads(),proto.getIndexOptions(), proto.getDocValuesType(), proto.getDocValuesGen(), new HashMap<>(),- proto.getPointDataDimensionCount(), proto.getPointIndexDimensionCount(), proto.getPointNumBytes(), proto.isSoftDeletesField());+ proto.getPointDimensionCount(), proto.getPointIndexDimensionCount(), proto.getPointNumBytes(), proto.isSoftDeletesField());FieldInfos fieldInfos = new FieldInfos(new FieldInfo[] { field } );diff --git a/lucene/test-framework/src/java/org/apache/lucene/index/BasePointsFormatTestCase.java b/lucene/test-framework/src/java/org/apache/lucene/index/BasePointsFormatTestCase.javaindex 398a7fe9354..f9772c1a588 100644--- a/lucene/test-framework/src/java/org/apache/lucene/index/BasePointsFormatTestCase.java+++ b/lucene/test-framework/src/java/org/apache/lucene/index/BasePointsFormatTestCase.java@@ -212,6 +212,7 @@ public abstract class BasePointsFormatTestCase extends BaseIndexFileFormatTestCaint numDocs = atLeast(1000);int numBytesPerDim = TestUtil.nextInt(random(), 2, PointValues.MAX_NUM_BYTES);int numDims = TestUtil.nextInt(random(), 1, PointValues.MAX_DIMENSIONS);+ int numIndexDims = TestUtil.nextInt(random(), 1, Math.min(numDims, PointValues.MAX_INDEX_DIMENSIONS));byte[][][] docValues = new byte[numDocs][][];@@ -231,7 +232,7 @@ public abstract class BasePointsFormatTestCase extends BaseIndexFileFormatTestCatry {dir.setRandomIOExceptionRate(0.05);dir.setRandomIOExceptionRateOnOpen(0.05);- verify(dir, docValues, null, numDims, numBytesPerDim, true);+ verify(dir, docValues, null, numDims, numIndexDims, numBytesPerDim, true);} catch (IllegalStateException ise) {done = handlePossiblyFakeException(ise);} catch (AssertionError ae) {@@ -270,6 +271,7 @@ public abstract class BasePointsFormatTestCase extends BaseIndexFileFormatTestCapublic void testMultiValued() throws Exception {int numBytesPerDim = TestUtil.nextInt(random(), 2, PointValues.MAX_NUM_BYTES);int numDims = TestUtil.nextInt(random(), 1, PointValues.MAX_DIMENSIONS);+ int numIndexDims = TestUtil.nextInt(random(), 1, Math.min(PointValues.MAX_INDEX_DIMENSIONS, numDims));int numDocs = TEST_NIGHTLY ? atLeast(1000) : atLeast(100);List<byte[][]> docValues = new ArrayList<>();@@ -294,12 +296,12 @@ public abstract class BasePointsFormatTestCase extends BaseIndexFileFormatTestCadocIDsArray[i] = docIDs.get(i);}- verify(docValuesArray, docIDsArray, numDims, numBytesPerDim);+ verify(docValuesArray, docIDsArray, numDims, numIndexDims, numBytesPerDim);}public void testAllEqual() throws Exception {int numBytesPerDim = TestUtil.nextInt(random(), 2, PointValues.MAX_NUM_BYTES);- int numDims = TestUtil.nextInt(random(), 1, PointValues.MAX_DIMENSIONS);+ int numDims = TestUtil.nextInt(random(), 1, PointValues.MAX_INDEX_DIMENSIONS);int numDocs = atLeast(1000);byte[][][] docValues = new byte[numDocs][][];@@ -322,7 +324,7 @@ public abstract class BasePointsFormatTestCase extends BaseIndexFileFormatTestCapublic void testOneDimEqual() throws Exception {int numBytesPerDim = TestUtil.nextInt(random(), 2, PointValues.MAX_NUM_BYTES);- int numDims = TestUtil.nextInt(random(), 1, PointValues.MAX_DIMENSIONS);+ int numDims = TestUtil.nextInt(random(), 1, PointValues.MAX_INDEX_DIMENSIONS);int numDocs = atLeast(1000);int theEqualDim = random().nextInt(numDims);@@ -346,7 +348,7 @@ public abstract class BasePointsFormatTestCase extends BaseIndexFileFormatTestCa// this should trigger run-length compression with lengths that are greater than 255public void testOneDimTwoValues() throws Exception {int numBytesPerDim = TestUtil.nextInt(random(), 2, PointValues.MAX_NUM_BYTES);- int numDims = TestUtil.nextInt(random(), 1, PointValues.MAX_DIMENSIONS);+ int numDims = TestUtil.nextInt(random(), 1, PointValues.MAX_INDEX_DIMENSIONS);int numDocs = atLeast(1000);int theDim = random().nextInt(numDims);@@ -378,7 +380,7 @@ public abstract class BasePointsFormatTestCase extends BaseIndexFileFormatTestCaint numDocs = atLeast(200);try (Directory dir = getDirectory(numDocs)) {int numBytesPerDim = TestUtil.nextInt(random(), 2, PointValues.MAX_NUM_BYTES);- int numDims = TestUtil.nextInt(random(), 1, PointValues.MAX_DIMENSIONS);+ int numDims = TestUtil.nextInt(random(), 1, PointValues.MAX_INDEX_DIMENSIONS);IndexWriterConfig iwc = newIndexWriterConfig(new MockAnalyzer(random()));// We rely on docIDs not changing:iwc.setMergePolicy(newLogMergePolicy());@@ -520,7 +522,7 @@ public abstract class BasePointsFormatTestCase extends BaseIndexFileFormatTestCaprivate void doTestRandomBinary(int count) throws Exception {int numDocs = TestUtil.nextInt(random(), count, count*2);int numBytesPerDim = TestUtil.nextInt(random(), 2, PointValues.MAX_NUM_BYTES);- int numDataDims = TestUtil.nextInt(random(), 1, PointValues.MAX_DIMENSIONS);+ int numDataDims = TestUtil.nextInt(random(), 1, PointValues.MAX_INDEX_DIMENSIONS);int numIndexDims = TestUtil.nextInt(random(), 1, numDataDims);byte[][][] docValues = new byte[numDocs][][];@@ -558,10 +560,6 @@ public abstract class BasePointsFormatTestCase extends BaseIndexFileFormatTestCa}}- private void verify(Directory dir, byte[][][] docValues, int[] ids, int numDims, int numBytesPerDim, boolean expectExceptions) throws Exception {- verify(dir, docValues, ids, numDims, numDims, numBytesPerDim, expectExceptions);- }-private byte[] flattenBinaryPoint(byte[][] value, int numDataDims, int numBytesPerDim) {byte[] result = new byte[value.length * numBytesPerDim];for (int d = 0; d < numDataDims; ++d) {@@ -571,10 +569,10 @@ public abstract class BasePointsFormatTestCase extends BaseIndexFileFormatTestCa}/** test selective indexing */- private void verify(Directory dir, byte[][][] docValues, int[] ids, int numDataDims, int numIndexDims, int numBytesPerDim, boolean expectExceptions) throws Exception {+ private void verify(Directory dir, byte[][][] docValues, int[] ids, int numDims, int numIndexDims, int numBytesPerDim, boolean expectExceptions) throws Exception {int numValues = docValues.length;if (VERBOSE) {- System.out.println("TEST: numValues=" + numValues + " numDataDims=" + numDataDims + " numIndexDims=" + numIndexDims + " numBytesPerDim=" + numBytesPerDim);+ System.out.println("TEST: numValues=" + numValues + " numDims=" + numDims + " numIndexDims=" + numIndexDims + " numBytesPerDim=" + numBytesPerDim);}// RandomIndexWriter is too slow:@@ -597,10 +595,10 @@ public abstract class BasePointsFormatTestCase extends BaseIndexFileFormatTestCaDirectoryReader r = null;// Compute actual min/max values:- byte[][] expectedMinValues = new byte[numDataDims][];- byte[][] expectedMaxValues = new byte[numDataDims][];+ byte[][] expectedMinValues = new byte[numDims][];+ byte[][] expectedMaxValues = new byte[numDims][];for(int ord=0;ord<docValues.length;ord++) {- for(int dim=0;dim<numDataDims;dim++) {+ for(int dim=0;dim<numDims;dim++) {if (ord == 0) {expectedMinValues[dim] = new byte[numBytesPerDim];System.arraycopy(docValues[ord][dim], 0, expectedMinValues[dim], 0, numBytesPerDim);@@ -649,7 +647,7 @@ public abstract class BasePointsFormatTestCase extends BaseIndexFileFormatTestCatry {FieldType fieldType = new FieldType();- fieldType.setDimensions(numDataDims, numIndexDims, numBytesPerDim);+ fieldType.setDimensions(numDims, numIndexDims, numBytesPerDim);fieldType.freeze();Document doc = null;@@ -673,7 +671,7 @@ public abstract class BasePointsFormatTestCase extends BaseIndexFileFormatTestCadoc.add(new NumericDocValuesField("id", id));}// pack the binary point- byte[] val = flattenBinaryPoint(docValues[ord], numDataDims, numBytesPerDim);+ byte[] val = flattenBinaryPoint(docValues[ord], numDims, numBytesPerDim);doc.add(new BinaryPoint("field", val, fieldType));lastID = id;@@ -693,7 +691,7 @@ public abstract class BasePointsFormatTestCase extends BaseIndexFileFormatTestCaif (random().nextInt(30) == 17) {// randomly index some documents with this field, but we will delete them:Document xdoc = new Document();- val = flattenBinaryPoint(docValues[ord], numDataDims, numBytesPerDim);+ val = flattenBinaryPoint(docValues[ord], numDims, numBytesPerDim);xdoc.add(new BinaryPoint("field", val, fieldType));xdoc.add(new StringField("nukeme", "yes", Field.Store.NO));if (useRealWriter) {@@ -716,7 +714,7 @@ public abstract class BasePointsFormatTestCase extends BaseIndexFileFormatTestCaif (VERBOSE) {System.out.println(" ord=" + ord + " id=" + id);- for(int dim=0;dim<numDataDims;dim++) {+ for(int dim=0;dim<numDims;dim++) {System.out.println(" dim=" + dim + " value=" + new BytesRef(docValues[ord][dim]));}}diff --git a/lucene/test-framework/src/java/org/apache/lucene/index/MismatchedLeafReader.java b/lucene/test-framework/src/java/org/apache/lucene/index/MismatchedLeafReader.javaindex e16ce4b1dbf..dd74a15dbd8 100644--- a/lucene/test-framework/src/java/org/apache/lucene/index/MismatchedLeafReader.java+++ b/lucene/test-framework/src/java/org/apache/lucene/index/MismatchedLeafReader.java@@ -77,7 +77,7 @@ public class MismatchedLeafReader extends FilterLeafReader {oldInfo.getDocValuesType(), // docValuesTypeoldInfo.getDocValuesGen(), // dvGenoldInfo.attributes(), // attributes- oldInfo.getPointDataDimensionCount(), // data dimension count+ oldInfo.getPointDimensionCount(), // data dimension countoldInfo.getPointIndexDimensionCount(), // index dimension countoldInfo.getPointNumBytes(), // dimension numBytesoldInfo.isSoftDeletesField()); // used as soft-deletes fielddiff --git a/lucene/test-framework/src/java/org/apache/lucene/index/RandomCodec.java b/lucene/test-framework/src/java/org/apache/lucene/index/RandomCodec.javaindex 01dfed0fd43..de1e64edf6a 100644--- a/lucene/test-framework/src/java/org/apache/lucene/index/RandomCodec.java+++ b/lucene/test-framework/src/java/org/apache/lucene/index/RandomCodec.java@@ -110,7 +110,7 @@ public class RandomCodec extends AssertingCodec {try (BKDWriter writer = new RandomlySplittingBKDWriter(writeState.segmentInfo.maxDoc(),writeState.directory,writeState.segmentInfo.name,- fieldInfo.getPointDataDimensionCount(),+ fieldInfo.getPointDimensionCount(),fieldInfo.getPointIndexDimensionCount(),fieldInfo.getPointNumBytes(),maxPointsInLeafNode,diff --git a/lucene/test-framework/src/java/org/apache/lucene/util/LuceneTestCase.java b/lucene/test-framework/src/java/org/apache/lucene/util/LuceneTestCase.javaindex 2e1166eabea..2c5025b0e28 100644--- a/lucene/test-framework/src/java/org/apache/lucene/util/LuceneTestCase.java+++ b/lucene/test-framework/src/java/org/apache/lucene/util/LuceneTestCase.java@@ -2677,10 +2677,10 @@ public abstract class LuceneTestCase extends Assert {FieldInfos fieldInfos1 = FieldInfos.getMergedFieldInfos(leftReader);FieldInfos fieldInfos2 = FieldInfos.getMergedFieldInfos(rightReader);for(FieldInfo fieldInfo1 : fieldInfos1) {- if (fieldInfo1.getPointDataDimensionCount() != 0) {+ if (fieldInfo1.getPointDimensionCount() != 0) {FieldInfo fieldInfo2 = fieldInfos2.fieldInfo(fieldInfo1.name);// same data dimension count?- assertEquals(info, fieldInfo2.getPointDataDimensionCount(), fieldInfo2.getPointDataDimensionCount());+ assertEquals(info, fieldInfo2.getPointDimensionCount(), fieldInfo2.getPointDimensionCount());// same index dimension count?assertEquals(info, fieldInfo2.getPointIndexDimensionCount(), fieldInfo2.getPointIndexDimensionCount());// same bytes per dimension?@@ -2694,10 +2694,10 @@ public abstract class LuceneTestCase extends Assert {// make sure FieldInfos2 doesn't have any point fields that FieldInfo1 didn't havefor(FieldInfo fieldInfo2 : fieldInfos2) {- if (fieldInfo2.getPointDataDimensionCount() != 0) {+ if (fieldInfo2.getPointDimensionCount() != 0) {FieldInfo fieldInfo1 = fieldInfos1.fieldInfo(fieldInfo2.name);// same data dimension count?- assertEquals(info, fieldInfo2.getPointDataDimensionCount(), fieldInfo1.getPointDataDimensionCount());+ assertEquals(info, fieldInfo2.getPointDimensionCount(), fieldInfo1.getPointDimensionCount());// same index dimension count?assertEquals(info, fieldInfo2.getPointIndexDimensionCount(), fieldInfo1.getPointIndexDimensionCount());// same bytes per dimension?diff --git a/lucene/test-framework/src/java/org/apache/lucene/util/TestUtil.java b/lucene/test-framework/src/java/org/apache/lucene/util/TestUtil.javaindex 73febcf6434..9fef84ea9ad 100644--- a/lucene/test-framework/src/java/org/apache/lucene/util/TestUtil.java+++ b/lucene/test-framework/src/java/org/apache/lucene/util/TestUtil.java@@ -1088,7 +1088,7 @@ public final class TestUtil {final Field field1 = (Field) f;final Field field2;final DocValuesType dvType = field1.fieldType().docValuesType();- final int dimCount = field1.fieldType().pointDataDimensionCount();+ final int dimCount = field1.fieldType().pointDimensionCount();if (dvType != DocValuesType.NONE) {switch(dvType) {case NUMERIC:diff --git a/solr/core/src/java/org/apache/solr/handler/admin/SegmentsInfoRequestHandler.java b/solr/core/src/java/org/apache/solr/handler/admin/SegmentsInfoRequestHandler.javaindex 90ac7ce3550..987c96fa280 100644--- a/solr/core/src/java/org/apache/solr/handler/admin/SegmentsInfoRequestHandler.java+++ b/solr/core/src/java/org/apache/solr/handler/admin/SegmentsInfoRequestHandler.java@@ -376,9 +376,9 @@ public class SegmentsInfoRequestHandler extends RequestHandlerBase {flags.append( (fi.hasPayloads() ? "p" : "-"));flags.append( (fi.isSoftDeletesField() ? "s" : "-"));- if (fi.getPointDataDimensionCount() > 0 || fi.getPointIndexDimensionCount() > 0) {+ if (fi.getPointDimensionCount() > 0 || fi.getPointIndexDimensionCount() > 0) {flags.append(":");- flags.append(fi.getPointDataDimensionCount()).append(':');+ flags.append(fi.getPointDimensionCount()).append(':');flags.append(fi.getPointIndexDimensionCount()).append(':');flags.append(fi.getPointNumBytes());}@@ -403,7 +403,7 @@ public class SegmentsInfoRequestHandler extends RequestHandlerBase {// check compliance of the index with the current schemaSchemaField sf = schema.getFieldOrNull(fi.name);- boolean hasPoints = fi.getPointDataDimensionCount() > 0 || fi.getPointIndexDimensionCount() > 0;+ boolean hasPoints = fi.getPointDimensionCount() > 0 || fi.getPointIndexDimensionCount() > 0;if (sf != null) {fieldFlags.add("schemaType", sf.getType().getTypeName());diff --git a/solr/core/src/java/org/apache/solr/legacy/BBoxStrategy.java b/solr/core/src/java/org/apache/solr/legacy/BBoxStrategy.javaindex b2f239ec95b..84f90ef7aa5 100644--- a/solr/core/src/java/org/apache/solr/legacy/BBoxStrategy.java+++ b/solr/core/src/java/org/apache/solr/legacy/BBoxStrategy.java@@ -173,7 +173,7 @@ public class BBoxStrategy extends SpatialStrategy {if ((this.hasDocVals = fieldType.docValuesType() != DocValuesType.NONE)) {numQuads++;}- if ((this.hasPointVals = fieldType.pointDataDimensionCount() > 0)) {+ if ((this.hasPointVals = fieldType.pointDimensionCount() > 0)) {numQuads++;}if (fieldType.indexOptions() != IndexOptions.NONE && fieldType instanceof LegacyFieldType && ((LegacyFieldType)fieldType).numericType() != null) {diff --git a/solr/core/src/java/org/apache/solr/legacy/PointVectorStrategy.java b/solr/core/src/java/org/apache/solr/legacy/PointVectorStrategy.javaindex 4df76cad70f..da48fcb667a 100644--- a/solr/core/src/java/org/apache/solr/legacy/PointVectorStrategy.java+++ b/solr/core/src/java/org/apache/solr/legacy/PointVectorStrategy.java@@ -152,7 +152,7 @@ public class PointVectorStrategy extends SpatialStrategy {if ((this.hasDocVals = fieldType.docValuesType() != DocValuesType.NONE)) {numPairs++;}- if ((this.hasPointVals = fieldType.pointDataDimensionCount() > 0)) {+ if ((this.hasPointVals = fieldType.pointDimensionCount() > 0)) {numPairs++;}if (fieldType.indexOptions() != IndexOptions.NONE && fieldType instanceof LegacyFieldType && ((LegacyFieldType)fieldType).numericType() != null) {diff --git a/solr/core/src/java/org/apache/solr/schema/SchemaField.java b/solr/core/src/java/org/apache/solr/schema/SchemaField.javaindex 23af61917d7..2f60ccc1441 100644--- a/solr/core/src/java/org/apache/solr/schema/SchemaField.java+++ b/solr/core/src/java/org/apache/solr/schema/SchemaField.java@@ -433,7 +433,7 @@ public final class SchemaField extends FieldProperties implements IndexableField}@Override- public int pointDataDimensionCount() {+ public int pointDimensionCount() {return 0;}diff --git a/solr/core/src/java/org/apache/solr/search/CollapsingQParserPlugin.java b/solr/core/src/java/org/apache/solr/search/CollapsingQParserPlugin.javaindex fc25c3c10c1..3630ddc50e6 100644--- a/solr/core/src/java/org/apache/solr/search/CollapsingQParserPlugin.java+++ b/solr/core/src/java/org/apache/solr/search/CollapsingQParserPlugin.java@@ -442,7 +442,7 @@ public class CollapsingQParserPlugin extends QParserPlugin {DocValuesType.NONE,fieldInfo.getDocValuesGen(),fieldInfo.attributes(),- fieldInfo.getPointDataDimensionCount(),+ fieldInfo.getPointDimensionCount(),fieldInfo.getPointIndexDimensionCount(),fieldInfo.getPointNumBytes(),fieldInfo.isSoftDeletesField());diff --git a/solr/core/src/java/org/apache/solr/search/Insanity.java b/solr/core/src/java/org/apache/solr/search/Insanity.javaindex 7da7a5ca9be..18b760f63ed 100644--- a/solr/core/src/java/org/apache/solr/search/Insanity.java+++ b/solr/core/src/java/org/apache/solr/search/Insanity.java@@ -67,7 +67,7 @@ public class Insanity {if (fi.name.equals(insaneField)) {filteredInfos.add(new FieldInfo(fi.name, fi.number, fi.hasVectors(), fi.omitsNorms(),fi.hasPayloads(), fi.getIndexOptions(), DocValuesType.NONE, -1, Collections.emptyMap(),- fi.getPointDataDimensionCount(), fi.getPointIndexDimensionCount(), fi.getPointNumBytes(), fi.isSoftDeletesField()));+ fi.getPointDimensionCount(), fi.getPointIndexDimensionCount(), fi.getPointNumBytes(), fi.isSoftDeletesField()));} else {filteredInfos.add(fi);}diff --git a/solr/core/src/java/org/apache/solr/uninverting/FieldCacheImpl.java b/solr/core/src/java/org/apache/solr/uninverting/FieldCacheImpl.javaindex 42c34ab78c2..e6e8fdac5fc 100644--- a/solr/core/src/java/org/apache/solr/uninverting/FieldCacheImpl.java+++ b/solr/core/src/java/org/apache/solr/uninverting/FieldCacheImpl.java@@ -592,11 +592,11 @@ public class FieldCacheImpl implements FieldCache {if (parser instanceof PointParser) {// points case// no points in this segment- if (info.getPointDataDimensionCount() == 0) {+ if (info.getPointDimensionCount() == 0) {return DocValues.emptyNumeric();}- if (info.getPointDataDimensionCount() != 1) {- throw new IllegalStateException("Type mismatch: " + field + " was indexed with dimensions=" + info.getPointDataDimensionCount());+ if (info.getPointDimensionCount() != 1) {+ throw new IllegalStateException("Type mismatch: " + field + " was indexed with dimensions=" + info.getPointDimensionCount());}PointValues values = reader.getPointValues(field);// no actual points for this field (e.g. all points deleted)diff --git a/solr/core/src/java/org/apache/solr/uninverting/UninvertingReader.java b/solr/core/src/java/org/apache/solr/uninverting/UninvertingReader.javaindex e8046351883..d83e70ebb5d 100644--- a/solr/core/src/java/org/apache/solr/uninverting/UninvertingReader.java+++ b/solr/core/src/java/org/apache/solr/uninverting/UninvertingReader.java@@ -237,12 +237,12 @@ public class UninvertingReader extends FilterLeafReader {DocValuesType type = fi.getDocValuesType();// fields which currently don't have docValues, but are uninvertable (indexed or points data present)if (type == DocValuesType.NONE &&- (fi.getIndexOptions() != IndexOptions.NONE || (fi.getPointNumBytes() > 0 && fi.getPointDataDimensionCount() == 1))) {+ (fi.getIndexOptions() != IndexOptions.NONE || (fi.getPointNumBytes() > 0 && fi.getPointDimensionCount() == 1))) {Type t = mapping.apply(fi.name); // could definitely return null, thus still can't uninvert itif (t != null) {if (t == Type.INTEGER_POINT || t == Type.LONG_POINT || t == Type.FLOAT_POINT || t == Type.DOUBLE_POINT) {// type uses points- if (fi.getPointDataDimensionCount() == 0) {+ if (fi.getPointDimensionCount() == 0) {continue;}} else {@@ -284,7 +284,7 @@ public class UninvertingReader extends FilterLeafReader {wrap = true;newFieldInfos.add(new FieldInfo(fi.name, fi.number, fi.hasVectors(), fi.omitsNorms(),fi.hasPayloads(), fi.getIndexOptions(), type, fi.getDocValuesGen(), fi.attributes(),- fi.getPointDataDimensionCount(), fi.getPointIndexDimensionCount(), fi.getPointNumBytes(), fi.isSoftDeletesField()));+ fi.getPointDimensionCount(), fi.getPointIndexDimensionCount(), fi.getPointNumBytes(), fi.isSoftDeletesField()));} else {newFieldInfos.add(fi);}diff --git a/solr/core/src/test/org/apache/solr/uninverting/TestUninvertingReader.java b/solr/core/src/test/org/apache/solr/uninverting/TestUninvertingReader.javaindex fda824683eb..7cce8f21cac 100644--- a/solr/core/src/test/org/apache/solr/uninverting/TestUninvertingReader.java+++ b/solr/core/src/test/org/apache/solr/uninverting/TestUninvertingReader.java@@ -379,13 +379,13 @@ public class TestUninvertingReader extends SolrTestCase {FieldInfo intFInfo = fieldInfos.fieldInfo("int");assertEquals(DocValuesType.NUMERIC, intFInfo.getDocValuesType());- assertEquals(0, intFInfo.getPointDataDimensionCount());+ assertEquals(0, intFInfo.getPointDimensionCount());assertEquals(0, intFInfo.getPointIndexDimensionCount());assertEquals(0, intFInfo.getPointNumBytes());FieldInfo dintFInfo = fieldInfos.fieldInfo("dint");assertEquals(DocValuesType.NUMERIC, dintFInfo.getDocValuesType());- assertEquals(1, dintFInfo.getPointDataDimensionCount());+ assertEquals(1, dintFInfo.getPointDimensionCount());assertEquals(1, dintFInfo.getPointIndexDimensionCount());assertEquals(4, dintFInfo.getPointNumBytes());