mirror of https://github.com/apache/lucene.git
LUCENE-9149: Increase data dimension limit in BKD
This commit is contained in:
parent
73dbf6d061
commit
206a70e7b7
|
@ -116,6 +116,8 @@ New Features
|
||||||
Improvements
|
Improvements
|
||||||
---------------------
|
---------------------
|
||||||
|
|
||||||
|
* LUCENE-9149: Increase data dimension limit in BKD. (Nick Knize)
|
||||||
|
|
||||||
* LUCENE-9102: Add maxQueryLength option to DirectSpellchecker. (Andy Webb via Bruno Roustant)
|
* 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)
|
* LUCENE-9091: UnifiedHighlighter HTML escaping should only escape essentials (Nándor Mátravölgyi)
|
||||||
|
|
|
@ -40,7 +40,7 @@ final class SimpleTextBKDReader extends PointValues implements Accountable {
|
||||||
final private byte[] splitPackedValues;
|
final private byte[] splitPackedValues;
|
||||||
final long[] leafBlockFPs;
|
final long[] leafBlockFPs;
|
||||||
final private int leafNodeOffset;
|
final private int leafNodeOffset;
|
||||||
final int numDataDims;
|
final int numDims;
|
||||||
final int numIndexDims;
|
final int numIndexDims;
|
||||||
final int bytesPerDim;
|
final int bytesPerDim;
|
||||||
final int bytesPerIndexEntry;
|
final int bytesPerIndexEntry;
|
||||||
|
@ -54,16 +54,16 @@ final class SimpleTextBKDReader extends PointValues implements Accountable {
|
||||||
protected final int packedBytesLength;
|
protected final int packedBytesLength;
|
||||||
protected final int packedIndexBytesLength;
|
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 {
|
byte[] minPackedValue, byte[] maxPackedValue, long pointCount, int docCount) throws IOException {
|
||||||
this.in = in;
|
this.in = in;
|
||||||
this.numDataDims = numDataDims;
|
this.numDims = numDims;
|
||||||
this.numIndexDims = numIndexDims;
|
this.numIndexDims = numIndexDims;
|
||||||
this.maxPointsInLeafNode = maxPointsInLeafNode;
|
this.maxPointsInLeafNode = maxPointsInLeafNode;
|
||||||
this.bytesPerDim = bytesPerDim;
|
this.bytesPerDim = bytesPerDim;
|
||||||
// no version check here because callers of this API (SimpleText) have no back compat:
|
// no version check here because callers of this API (SimpleText) have no back compat:
|
||||||
bytesPerIndexEntry = numIndexDims == 1 ? bytesPerDim : bytesPerDim + 1;
|
bytesPerIndexEntry = numIndexDims == 1 ? bytesPerDim : bytesPerDim + 1;
|
||||||
packedBytesLength = numDataDims * bytesPerDim;
|
packedBytesLength = numDims * bytesPerDim;
|
||||||
packedIndexBytesLength = numIndexDims * bytesPerDim;
|
packedIndexBytesLength = numIndexDims * bytesPerDim;
|
||||||
this.leafNodeOffset = leafBlockFPs.length;
|
this.leafNodeOffset = leafBlockFPs.length;
|
||||||
this.leafBlockFPs = leafBlockFPs;
|
this.leafBlockFPs = leafBlockFPs;
|
||||||
|
@ -118,7 +118,7 @@ final class SimpleTextBKDReader extends PointValues implements Accountable {
|
||||||
|
|
||||||
/** Create a new {@link IntersectState} */
|
/** Create a new {@link IntersectState} */
|
||||||
public IntersectState getIntersectState(IntersectVisitor visitor) {
|
public IntersectState getIntersectState(IntersectVisitor visitor) {
|
||||||
return new IntersectState(in.clone(), numDataDims,
|
return new IntersectState(in.clone(), numDims,
|
||||||
packedBytesLength,
|
packedBytesLength,
|
||||||
maxPointsInLeafNode,
|
maxPointsInLeafNode,
|
||||||
visitor);
|
visitor);
|
||||||
|
@ -184,7 +184,7 @@ final class SimpleTextBKDReader extends PointValues implements Accountable {
|
||||||
scratchPackedValue[compressedByteOffset] = in.readByte();
|
scratchPackedValue[compressedByteOffset] = in.readByte();
|
||||||
final int runLen = Byte.toUnsignedInt(in.readByte());
|
final int runLen = Byte.toUnsignedInt(in.readByte());
|
||||||
for (int j = 0; j < runLen; ++j) {
|
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];
|
int prefix = commonPrefixLengths[dim];
|
||||||
in.readBytes(scratchPackedValue, dim*bytesPerDim + prefix, bytesPerDim - prefix);
|
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 {
|
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();
|
int prefix = in.readVInt();
|
||||||
commonPrefixLengths[dim] = prefix;
|
commonPrefixLengths[dim] = prefix;
|
||||||
if (prefix > 0) {
|
if (prefix > 0) {
|
||||||
|
@ -370,8 +370,8 @@ final class SimpleTextBKDReader extends PointValues implements Accountable {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getNumDataDimensions() {
|
public int getNumDimensions() {
|
||||||
return numDataDims;
|
return numDims;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -95,8 +95,11 @@ final class SimpleTextBKDWriter implements Closeable {
|
||||||
/** Default maximum heap to use, before spilling to (slower) disk */
|
/** Default maximum heap to use, before spilling to (slower) disk */
|
||||||
public static final float DEFAULT_MAX_MB_SORT_IN_HEAP = 16.0f;
|
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 */
|
/** 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 */
|
/** How many dimensions we are storing at the leaf (data) nodes */
|
||||||
protected final int numDataDims;
|
protected final int numDataDims;
|
||||||
|
@ -107,7 +110,7 @@ final class SimpleTextBKDWriter implements Closeable {
|
||||||
/** How many bytes each value in each dimension takes. */
|
/** How many bytes each value in each dimension takes. */
|
||||||
protected final int bytesPerDim;
|
protected final int bytesPerDim;
|
||||||
|
|
||||||
/** numDataDims * bytesPerDim */
|
/** numDims * bytesPerDim */
|
||||||
protected final int packedBytesLength;
|
protected final int packedBytesLength;
|
||||||
|
|
||||||
/** numIndexDims * bytesPerDim */
|
/** numIndexDims * bytesPerDim */
|
||||||
|
@ -188,14 +191,17 @@ final class SimpleTextBKDWriter implements Closeable {
|
||||||
this.maxMBSortInHeap = maxMBSortInHeap;
|
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
|
// 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
|
// remaining 4 bits for another purpose later
|
||||||
if (numDataDims < 1 || numDataDims > MAX_DIMS) {
|
if (numDims < 1 || numDims > MAX_DIMS) {
|
||||||
throw new IllegalArgumentException("numDataDims must be 1 .. " + MAX_DIMS + " (got: " + numDataDims + ")");
|
throw new IllegalArgumentException("numDims must be 1 .. " + MAX_DIMS + " (got: " + numDims + ")");
|
||||||
}
|
}
|
||||||
if (numIndexDims < 1 || numIndexDims > numDataDims) {
|
if (numIndexDims < 1 || numIndexDims > MAX_INDEX_DIMS) {
|
||||||
throw new IllegalArgumentException("numIndexDims must be 1 .. " + numDataDims + " (got: " + numIndexDims + ")");
|
throw new IllegalArgumentException("numIndexDims must be 1 .. " + MAX_INDEX_DIMS + " (got: " + numIndexDims + ")");
|
||||||
|
}
|
||||||
|
if (numIndexDims > numDims) {
|
||||||
|
throw new IllegalArgumentException("numIndexDims cannot exceed numDims (" + numDims + ") (got: " + numIndexDims + ")");
|
||||||
}
|
}
|
||||||
if (maxPointsInLeafNode <= 0) {
|
if (maxPointsInLeafNode <= 0) {
|
||||||
throw new IllegalArgumentException("maxPointsInLeafNode must be > 0; got " + maxPointsInLeafNode);
|
throw new IllegalArgumentException("maxPointsInLeafNode must be > 0; got " + maxPointsInLeafNode);
|
||||||
|
|
|
@ -136,7 +136,7 @@ public class SimpleTextFieldInfosFormat extends FieldInfosFormat {
|
||||||
|
|
||||||
SimpleTextUtil.readLine(input, scratch);
|
SimpleTextUtil.readLine(input, scratch);
|
||||||
assert StringHelper.startsWith(scratch.get(), DATA_DIM_COUNT);
|
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);
|
SimpleTextUtil.readLine(input, scratch);
|
||||||
assert StringHelper.startsWith(scratch.get(), INDEX_DIM_COUNT);
|
assert StringHelper.startsWith(scratch.get(), INDEX_DIM_COUNT);
|
||||||
|
@ -152,7 +152,7 @@ public class SimpleTextFieldInfosFormat extends FieldInfosFormat {
|
||||||
|
|
||||||
infos[i] = new FieldInfo(name, fieldNumber, storeTermVector,
|
infos[i] = new FieldInfo(name, fieldNumber, storeTermVector,
|
||||||
omitNorms, storePayloads, indexOptions, docValuesType, dvGen, Collections.unmodifiableMap(atts),
|
omitNorms, storePayloads, indexOptions, docValuesType, dvGen, Collections.unmodifiableMap(atts),
|
||||||
dataDimensionalCount, indexDimensionalCount, dimensionalNumBytes, isSoftDeletesField);
|
dimensionalCount, indexDimensionalCount, dimensionalNumBytes, isSoftDeletesField);
|
||||||
}
|
}
|
||||||
|
|
||||||
SimpleTextUtil.checkFooter(input);
|
SimpleTextUtil.checkFooter(input);
|
||||||
|
@ -242,7 +242,7 @@ public class SimpleTextFieldInfosFormat extends FieldInfosFormat {
|
||||||
}
|
}
|
||||||
|
|
||||||
SimpleTextUtil.write(out, DATA_DIM_COUNT);
|
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.writeNewline(out);
|
||||||
|
|
||||||
SimpleTextUtil.write(out, INDEX_DIM_COUNT);
|
SimpleTextUtil.write(out, INDEX_DIM_COUNT);
|
||||||
|
|
|
@ -195,7 +195,7 @@ class SimpleTextPointsReader extends PointsReader {
|
||||||
if (fieldInfo == null) {
|
if (fieldInfo == null) {
|
||||||
throw new IllegalArgumentException("field=\"" + fieldName + "\" is unrecognized");
|
throw new IllegalArgumentException("field=\"" + fieldName + "\" is unrecognized");
|
||||||
}
|
}
|
||||||
if (fieldInfo.getPointDataDimensionCount() == 0) {
|
if (fieldInfo.getPointDimensionCount() == 0) {
|
||||||
throw new IllegalArgumentException("field=\"" + fieldName + "\" did not index points");
|
throw new IllegalArgumentException("field=\"" + fieldName + "\" did not index points");
|
||||||
}
|
}
|
||||||
return readers.get(fieldName);
|
return readers.get(fieldName);
|
||||||
|
|
|
@ -76,7 +76,7 @@ class SimpleTextPointsWriter extends PointsWriter {
|
||||||
try (SimpleTextBKDWriter writer = new SimpleTextBKDWriter(writeState.segmentInfo.maxDoc(),
|
try (SimpleTextBKDWriter writer = new SimpleTextBKDWriter(writeState.segmentInfo.maxDoc(),
|
||||||
writeState.directory,
|
writeState.directory,
|
||||||
writeState.segmentInfo.name,
|
writeState.segmentInfo.name,
|
||||||
fieldInfo.getPointDataDimensionCount(),
|
fieldInfo.getPointDimensionCount(),
|
||||||
fieldInfo.getPointIndexDimensionCount(),
|
fieldInfo.getPointIndexDimensionCount(),
|
||||||
fieldInfo.getPointNumBytes(),
|
fieldInfo.getPointNumBytes(),
|
||||||
SimpleTextBKDWriter.DEFAULT_MAX_POINTS_IN_LEAF_NODE,
|
SimpleTextBKDWriter.DEFAULT_MAX_POINTS_IN_LEAF_NODE,
|
||||||
|
|
|
@ -48,7 +48,7 @@ public abstract class PointsWriter implements Closeable {
|
||||||
PointsReader pointsReader = mergeState.pointsReaders[i];
|
PointsReader pointsReader = mergeState.pointsReaders[i];
|
||||||
if (pointsReader != null) {
|
if (pointsReader != null) {
|
||||||
FieldInfo readerFieldInfo = mergeState.fieldInfos[i].fieldInfo(fieldInfo.name);
|
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);
|
PointValues values = pointsReader.getValues(fieldInfo.name);
|
||||||
if (values != null) {
|
if (values != null) {
|
||||||
maxPointCount += values.size();
|
maxPointCount += values.size();
|
||||||
|
@ -92,7 +92,7 @@ public abstract class PointsWriter implements Closeable {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (readerFieldInfo.getPointDataDimensionCount() == 0) {
|
if (readerFieldInfo.getPointDimensionCount() == 0) {
|
||||||
// This segment saw this field, but the field did not index points in it:
|
// This segment saw this field, but the field did not index points in it:
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -143,7 +143,7 @@ public abstract class PointsWriter implements Closeable {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getNumDataDimensions() {
|
public int getNumDimensions() {
|
||||||
throw new UnsupportedOperationException();
|
throw new UnsupportedOperationException();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -187,7 +187,7 @@ public abstract class PointsWriter implements Closeable {
|
||||||
}
|
}
|
||||||
// merge field at a time
|
// merge field at a time
|
||||||
for (FieldInfo fieldInfo : mergeState.mergeFieldInfos) {
|
for (FieldInfo fieldInfo : mergeState.mergeFieldInfos) {
|
||||||
if (fieldInfo.getPointDataDimensionCount() != 0) {
|
if (fieldInfo.getPointDimensionCount() != 0) {
|
||||||
mergeOneField(mergeState, fieldInfo);
|
mergeOneField(mergeState, fieldInfo);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -291,8 +291,8 @@ public final class Lucene60FieldInfosFormat extends FieldInfosFormat {
|
||||||
output.writeByte(docValuesByte(fi.getDocValuesType()));
|
output.writeByte(docValuesByte(fi.getDocValuesType()));
|
||||||
output.writeLong(fi.getDocValuesGen());
|
output.writeLong(fi.getDocValuesGen());
|
||||||
output.writeMapOfStrings(fi.attributes());
|
output.writeMapOfStrings(fi.attributes());
|
||||||
output.writeVInt(fi.getPointDataDimensionCount());
|
output.writeVInt(fi.getPointDimensionCount());
|
||||||
if (fi.getPointDataDimensionCount() != 0) {
|
if (fi.getPointDimensionCount() != 0) {
|
||||||
output.writeVInt(fi.getPointIndexDimensionCount());
|
output.writeVInt(fi.getPointIndexDimensionCount());
|
||||||
output.writeVInt(fi.getPointNumBytes());
|
output.writeVInt(fi.getPointNumBytes());
|
||||||
}
|
}
|
||||||
|
|
|
@ -124,7 +124,7 @@ public class Lucene60PointsReader extends PointsReader implements Closeable {
|
||||||
if (fieldInfo == null) {
|
if (fieldInfo == null) {
|
||||||
throw new IllegalArgumentException("field=\"" + fieldName + "\" is unrecognized");
|
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");
|
throw new IllegalArgumentException("field=\"" + fieldName + "\" did not index point values");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -93,7 +93,7 @@ public class Lucene60PointsWriter extends PointsWriter implements Closeable {
|
||||||
try (BKDWriter writer = new BKDWriter(writeState.segmentInfo.maxDoc(),
|
try (BKDWriter writer = new BKDWriter(writeState.segmentInfo.maxDoc(),
|
||||||
writeState.directory,
|
writeState.directory,
|
||||||
writeState.segmentInfo.name,
|
writeState.segmentInfo.name,
|
||||||
fieldInfo.getPointDataDimensionCount(),
|
fieldInfo.getPointDimensionCount(),
|
||||||
fieldInfo.getPointIndexDimensionCount(),
|
fieldInfo.getPointIndexDimensionCount(),
|
||||||
fieldInfo.getPointNumBytes(),
|
fieldInfo.getPointNumBytes(),
|
||||||
maxPointsInLeafNode,
|
maxPointsInLeafNode,
|
||||||
|
@ -151,8 +151,8 @@ public class Lucene60PointsWriter extends PointsWriter implements Closeable {
|
||||||
}
|
}
|
||||||
|
|
||||||
for (FieldInfo fieldInfo : mergeState.mergeFieldInfos) {
|
for (FieldInfo fieldInfo : mergeState.mergeFieldInfos) {
|
||||||
if (fieldInfo.getPointDataDimensionCount() != 0) {
|
if (fieldInfo.getPointDimensionCount() != 0) {
|
||||||
if (fieldInfo.getPointDataDimensionCount() == 1) {
|
if (fieldInfo.getPointDimensionCount() == 1) {
|
||||||
|
|
||||||
// Worst case total maximum size (if none of the points are deleted):
|
// Worst case total maximum size (if none of the points are deleted):
|
||||||
long totMaxSize = 0;
|
long totMaxSize = 0;
|
||||||
|
@ -161,7 +161,7 @@ public class Lucene60PointsWriter extends PointsWriter implements Closeable {
|
||||||
if (reader != null) {
|
if (reader != null) {
|
||||||
FieldInfos readerFieldInfos = mergeState.fieldInfos[i];
|
FieldInfos readerFieldInfos = mergeState.fieldInfos[i];
|
||||||
FieldInfo readerFieldInfo = readerFieldInfos.fieldInfo(fieldInfo.name);
|
FieldInfo readerFieldInfo = readerFieldInfos.fieldInfo(fieldInfo.name);
|
||||||
if (readerFieldInfo != null && readerFieldInfo.getPointDataDimensionCount() > 0) {
|
if (readerFieldInfo != null && readerFieldInfo.getPointDimensionCount() > 0) {
|
||||||
PointValues values = reader.getValues(fieldInfo.name);
|
PointValues values = reader.getValues(fieldInfo.name);
|
||||||
if (values != null) {
|
if (values != null) {
|
||||||
totMaxSize += values.size();
|
totMaxSize += values.size();
|
||||||
|
@ -177,7 +177,7 @@ public class Lucene60PointsWriter extends PointsWriter implements Closeable {
|
||||||
try (BKDWriter writer = new BKDWriter(writeState.segmentInfo.maxDoc(),
|
try (BKDWriter writer = new BKDWriter(writeState.segmentInfo.maxDoc(),
|
||||||
writeState.directory,
|
writeState.directory,
|
||||||
writeState.segmentInfo.name,
|
writeState.segmentInfo.name,
|
||||||
fieldInfo.getPointDataDimensionCount(),
|
fieldInfo.getPointDimensionCount(),
|
||||||
fieldInfo.getPointIndexDimensionCount(),
|
fieldInfo.getPointIndexDimensionCount(),
|
||||||
fieldInfo.getPointNumBytes(),
|
fieldInfo.getPointNumBytes(),
|
||||||
maxPointsInLeafNode,
|
maxPointsInLeafNode,
|
||||||
|
@ -200,7 +200,7 @@ public class Lucene60PointsWriter extends PointsWriter implements Closeable {
|
||||||
|
|
||||||
FieldInfos readerFieldInfos = mergeState.fieldInfos[i];
|
FieldInfos readerFieldInfos = mergeState.fieldInfos[i];
|
||||||
FieldInfo readerFieldInfo = readerFieldInfos.fieldInfo(fieldInfo.name);
|
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);
|
BKDReader bkdReader = reader60.readers.get(readerFieldInfo.number);
|
||||||
if (bkdReader != null) {
|
if (bkdReader != null) {
|
||||||
bkdReaders.add(bkdReader);
|
bkdReaders.add(bkdReader);
|
||||||
|
|
|
@ -134,7 +134,7 @@ final class PerFieldMergeState {
|
||||||
hasNorms |= fi.hasNorms();
|
hasNorms |= fi.hasNorms();
|
||||||
hasDocValues |= fi.getDocValuesType() != DocValuesType.NONE;
|
hasDocValues |= fi.getDocValuesType() != DocValuesType.NONE;
|
||||||
hasPayloads |= fi.hasPayloads();
|
hasPayloads |= fi.hasPayloads();
|
||||||
hasPointValues |= (fi.getPointDataDimensionCount() != 0);
|
hasPointValues |= (fi.getPointDimensionCount() != 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -123,8 +123,8 @@ public final class BinaryPoint extends Field {
|
||||||
/** Expert API */
|
/** Expert API */
|
||||||
public BinaryPoint(String name, byte[] packedPoint, IndexableFieldType type) {
|
public BinaryPoint(String name, byte[] packedPoint, IndexableFieldType type) {
|
||||||
super(name, packedPoint, type);
|
super(name, packedPoint, type);
|
||||||
if (packedPoint.length != type.pointDataDimensionCount() * type.pointNumBytes()) {
|
if (packedPoint.length != type.pointDimensionCount() * type.pointNumBytes()) {
|
||||||
throw new IllegalArgumentException("packedPoint is length=" + packedPoint.length + " but type.pointDimensionCount()=" + type.pointDataDimensionCount() + " and type.pointNumBytes()=" + type.pointNumBytes());
|
throw new IllegalArgumentException("packedPoint is length=" + packedPoint.length + " but type.pointDimensionCount()=" + type.pointDimensionCount() + " and type.pointNumBytes()=" + type.pointNumBytes());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -84,8 +84,8 @@ public final class DoublePoint extends Field {
|
||||||
|
|
||||||
/** Change the values of this field */
|
/** Change the values of this field */
|
||||||
public void setDoubleValues(double... point) {
|
public void setDoubleValues(double... point) {
|
||||||
if (type.pointDataDimensionCount() != point.length) {
|
if (type.pointDimensionCount() != point.length) {
|
||||||
throw new IllegalArgumentException("this field (name=" + name + ") uses " + type.pointDataDimensionCount() + " dimensions; cannot change to (incoming) " + point.length + " dimensions");
|
throw new IllegalArgumentException("this field (name=" + name + ") uses " + type.pointDimensionCount() + " dimensions; cannot change to (incoming) " + point.length + " dimensions");
|
||||||
}
|
}
|
||||||
fieldsData = pack(point);
|
fieldsData = pack(point);
|
||||||
}
|
}
|
||||||
|
@ -97,8 +97,8 @@ public final class DoublePoint extends Field {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Number numericValue() {
|
public Number numericValue() {
|
||||||
if (type.pointDataDimensionCount() != 1) {
|
if (type.pointDimensionCount() != 1) {
|
||||||
throw new IllegalStateException("this field (name=" + name + ") uses " + type.pointDataDimensionCount() + " dimensions; cannot convert to a single numeric value");
|
throw new IllegalStateException("this field (name=" + name + ") uses " + type.pointDimensionCount() + " dimensions; cannot convert to a single numeric value");
|
||||||
}
|
}
|
||||||
BytesRef bytes = (BytesRef) fieldsData;
|
BytesRef bytes = (BytesRef) fieldsData;
|
||||||
assert bytes.length == Double.BYTES;
|
assert bytes.length == Double.BYTES;
|
||||||
|
@ -147,7 +147,7 @@ public final class DoublePoint extends Field {
|
||||||
result.append(':');
|
result.append(':');
|
||||||
|
|
||||||
BytesRef bytes = (BytesRef) fieldsData;
|
BytesRef bytes = (BytesRef) fieldsData;
|
||||||
for (int dim = 0; dim < type.pointDataDimensionCount(); dim++) {
|
for (int dim = 0; dim < type.pointDimensionCount(); dim++) {
|
||||||
if (dim > 0) {
|
if (dim > 0) {
|
||||||
result.append(',');
|
result.append(',');
|
||||||
}
|
}
|
||||||
|
|
|
@ -78,8 +78,8 @@ public class DoubleRange extends Field {
|
||||||
*/
|
*/
|
||||||
public void setRangeValues(double[] min, double[] max) {
|
public void setRangeValues(double[] min, double[] max) {
|
||||||
checkArgs(min, max);
|
checkArgs(min, max);
|
||||||
if (min.length*2 != type.pointDataDimensionCount() || max.length*2 != type.pointDataDimensionCount()) {
|
if (min.length*2 != type.pointDimensionCount() || max.length*2 != type.pointDimensionCount()) {
|
||||||
throw new IllegalArgumentException("field (name=" + name + ") uses " + type.pointDataDimensionCount()/2
|
throw new IllegalArgumentException("field (name=" + name + ") uses " + type.pointDimensionCount()/2
|
||||||
+ " dimensions; cannot change to (incoming) " + min.length + " dimensions");
|
+ " dimensions; cannot change to (incoming) " + min.length + " dimensions");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -149,7 +149,7 @@ public class DoubleRange extends Field {
|
||||||
* @return the decoded min value
|
* @return the decoded min value
|
||||||
*/
|
*/
|
||||||
public double getMin(int dimension) {
|
public double getMin(int dimension) {
|
||||||
Objects.checkIndex(dimension, type.pointDataDimensionCount()/2);
|
Objects.checkIndex(dimension, type.pointDimensionCount()/2);
|
||||||
return decodeMin(((BytesRef)fieldsData).bytes, dimension);
|
return decodeMin(((BytesRef)fieldsData).bytes, dimension);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -159,7 +159,7 @@ public class DoubleRange extends Field {
|
||||||
* @return the decoded max value
|
* @return the decoded max value
|
||||||
*/
|
*/
|
||||||
public double getMax(int dimension) {
|
public double getMax(int dimension) {
|
||||||
Objects.checkIndex(dimension, type.pointDataDimensionCount()/2);
|
Objects.checkIndex(dimension, type.pointDimensionCount()/2);
|
||||||
return decodeMax(((BytesRef)fieldsData).bytes, dimension);
|
return decodeMax(((BytesRef)fieldsData).bytes, dimension);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -245,7 +245,7 @@ public class DoubleRange extends Field {
|
||||||
sb.append(':');
|
sb.append(':');
|
||||||
byte[] b = ((BytesRef)fieldsData).bytes;
|
byte[] b = ((BytesRef)fieldsData).bytes;
|
||||||
toString(b, 0);
|
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(' ');
|
||||||
sb.append(toString(b, d));
|
sb.append(toString(b, d));
|
||||||
}
|
}
|
||||||
|
|
|
@ -41,7 +41,7 @@ public class FieldType implements IndexableFieldType {
|
||||||
private IndexOptions indexOptions = IndexOptions.NONE;
|
private IndexOptions indexOptions = IndexOptions.NONE;
|
||||||
private boolean frozen;
|
private boolean frozen;
|
||||||
private DocValuesType docValuesType = DocValuesType.NONE;
|
private DocValuesType docValuesType = DocValuesType.NONE;
|
||||||
private int dataDimensionCount;
|
private int dimensionCount;
|
||||||
private int indexDimensionCount;
|
private int indexDimensionCount;
|
||||||
private int dimensionNumBytes;
|
private int dimensionNumBytes;
|
||||||
private Map<String, String> attributes;
|
private Map<String, String> attributes;
|
||||||
|
@ -59,7 +59,7 @@ public class FieldType implements IndexableFieldType {
|
||||||
this.omitNorms = ref.omitNorms();
|
this.omitNorms = ref.omitNorms();
|
||||||
this.indexOptions = ref.indexOptions();
|
this.indexOptions = ref.indexOptions();
|
||||||
this.docValuesType = ref.docValuesType();
|
this.docValuesType = ref.docValuesType();
|
||||||
this.dataDimensionCount = ref.pointDataDimensionCount();
|
this.dimensionCount = ref.pointDimensionCount();
|
||||||
this.indexDimensionCount = ref.pointIndexDimensionCount();
|
this.indexDimensionCount = ref.pointIndexDimensionCount();
|
||||||
this.dimensionNumBytes = ref.pointNumBytes();
|
this.dimensionNumBytes = ref.pointNumBytes();
|
||||||
if (ref.getAttributes() != null) {
|
if (ref.getAttributes() != null) {
|
||||||
|
@ -294,18 +294,21 @@ public class FieldType implements IndexableFieldType {
|
||||||
/**
|
/**
|
||||||
* Enables points indexing with selectable dimension indexing.
|
* Enables points indexing with selectable dimension indexing.
|
||||||
*/
|
*/
|
||||||
public void setDimensions(int dataDimensionCount, int indexDimensionCount, int dimensionNumBytes) {
|
public void setDimensions(int dimensionCount, int indexDimensionCount, int dimensionNumBytes) {
|
||||||
if (dataDimensionCount < 0) {
|
if (dimensionCount < 0) {
|
||||||
throw new IllegalArgumentException("dataDimensionCount must be >= 0; got " + dataDimensionCount);
|
throw new IllegalArgumentException("dimensionCount must be >= 0; got " + dimensionCount);
|
||||||
}
|
}
|
||||||
if (dataDimensionCount > PointValues.MAX_DIMENSIONS) {
|
if (dimensionCount > PointValues.MAX_DIMENSIONS) {
|
||||||
throw new IllegalArgumentException("dataDimensionCount must be <= " + PointValues.MAX_DIMENSIONS + "; got " + dataDimensionCount);
|
throw new IllegalArgumentException("dimensionCount must be <= " + PointValues.MAX_DIMENSIONS + "; got " + dimensionCount);
|
||||||
}
|
}
|
||||||
if (indexDimensionCount < 0) {
|
if (indexDimensionCount < 0) {
|
||||||
throw new IllegalArgumentException("indexDimensionCount must be >= 0; got " + indexDimensionCount);
|
throw new IllegalArgumentException("indexDimensionCount must be >= 0; got " + indexDimensionCount);
|
||||||
}
|
}
|
||||||
if (indexDimensionCount > dataDimensionCount) {
|
if (indexDimensionCount > dimensionCount) {
|
||||||
throw new IllegalArgumentException("indexDimensionCount must be <= dataDimensionCount: " + dataDimensionCount + "; got " + indexDimensionCount);
|
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) {
|
if (dimensionNumBytes < 0) {
|
||||||
throw new IllegalArgumentException("dimensionNumBytes must be >= 0; got " + dimensionNumBytes);
|
throw new IllegalArgumentException("dimensionNumBytes must be >= 0; got " + dimensionNumBytes);
|
||||||
|
@ -313,29 +316,29 @@ public class FieldType implements IndexableFieldType {
|
||||||
if (dimensionNumBytes > PointValues.MAX_NUM_BYTES) {
|
if (dimensionNumBytes > PointValues.MAX_NUM_BYTES) {
|
||||||
throw new IllegalArgumentException("dimensionNumBytes must be <= " + PointValues.MAX_NUM_BYTES + "; got " + dimensionNumBytes);
|
throw new IllegalArgumentException("dimensionNumBytes must be <= " + PointValues.MAX_NUM_BYTES + "; got " + dimensionNumBytes);
|
||||||
}
|
}
|
||||||
if (dataDimensionCount == 0) {
|
if (dimensionCount == 0) {
|
||||||
if (indexDimensionCount != 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) {
|
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) {
|
} 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) {
|
} else if (dimensionNumBytes == 0) {
|
||||||
if (dataDimensionCount != 0) {
|
if (dimensionCount != 0) {
|
||||||
throw new IllegalArgumentException("when dimensionNumBytes is 0, dataDimensionCount must be 0; got " + dataDimensionCount);
|
throw new IllegalArgumentException("when dimensionNumBytes is 0, dimensionCount must be 0; got " + dimensionCount);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
this.dataDimensionCount = dataDimensionCount;
|
this.dimensionCount = dimensionCount;
|
||||||
this.indexDimensionCount = indexDimensionCount;
|
this.indexDimensionCount = indexDimensionCount;
|
||||||
this.dimensionNumBytes = dimensionNumBytes;
|
this.dimensionNumBytes = dimensionNumBytes;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int pointDataDimensionCount() {
|
public int pointDimensionCount() {
|
||||||
return dataDimensionCount;
|
return dimensionCount;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -407,12 +410,12 @@ public class FieldType implements IndexableFieldType {
|
||||||
result.append(indexOptions);
|
result.append(indexOptions);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (dataDimensionCount != 0) {
|
if (dimensionCount != 0) {
|
||||||
if (result.length() > 0) {
|
if (result.length() > 0) {
|
||||||
result.append(",");
|
result.append(",");
|
||||||
}
|
}
|
||||||
result.append("pointDataDimensionCount=");
|
result.append("pointDimensionCount=");
|
||||||
result.append(dataDimensionCount);
|
result.append(dimensionCount);
|
||||||
result.append(",pointIndexDimensionCount=");
|
result.append(",pointIndexDimensionCount=");
|
||||||
result.append(indexDimensionCount);
|
result.append(indexDimensionCount);
|
||||||
result.append(",pointNumBytes=");
|
result.append(",pointNumBytes=");
|
||||||
|
@ -459,7 +462,7 @@ public class FieldType implements IndexableFieldType {
|
||||||
public int hashCode() {
|
public int hashCode() {
|
||||||
final int prime = 31;
|
final int prime = 31;
|
||||||
int result = 1;
|
int result = 1;
|
||||||
result = prime * result + dataDimensionCount;
|
result = prime * result + dimensionCount;
|
||||||
result = prime * result + indexDimensionCount;
|
result = prime * result + indexDimensionCount;
|
||||||
result = prime * result + dimensionNumBytes;
|
result = prime * result + dimensionNumBytes;
|
||||||
result = prime * result + ((docValuesType == null) ? 0 : docValuesType.hashCode());
|
result = prime * result + ((docValuesType == null) ? 0 : docValuesType.hashCode());
|
||||||
|
@ -480,7 +483,7 @@ public class FieldType implements IndexableFieldType {
|
||||||
if (obj == null) return false;
|
if (obj == null) return false;
|
||||||
if (getClass() != obj.getClass()) return false;
|
if (getClass() != obj.getClass()) return false;
|
||||||
FieldType other = (FieldType) obj;
|
FieldType other = (FieldType) obj;
|
||||||
if (dataDimensionCount != other.dataDimensionCount) return false;
|
if (dimensionCount != other.dimensionCount) return false;
|
||||||
if (indexDimensionCount != other.indexDimensionCount) return false;
|
if (indexDimensionCount != other.indexDimensionCount) return false;
|
||||||
if (dimensionNumBytes != other.dimensionNumBytes) return false;
|
if (dimensionNumBytes != other.dimensionNumBytes) return false;
|
||||||
if (docValuesType != other.docValuesType) return false;
|
if (docValuesType != other.docValuesType) return false;
|
||||||
|
|
|
@ -84,8 +84,8 @@ public final class FloatPoint extends Field {
|
||||||
|
|
||||||
/** Change the values of this field */
|
/** Change the values of this field */
|
||||||
public void setFloatValues(float... point) {
|
public void setFloatValues(float... point) {
|
||||||
if (type.pointDataDimensionCount() != point.length) {
|
if (type.pointDimensionCount() != point.length) {
|
||||||
throw new IllegalArgumentException("this field (name=" + name + ") uses " + type.pointDataDimensionCount() + " dimensions; cannot change to (incoming) " + point.length + " dimensions");
|
throw new IllegalArgumentException("this field (name=" + name + ") uses " + type.pointDimensionCount() + " dimensions; cannot change to (incoming) " + point.length + " dimensions");
|
||||||
}
|
}
|
||||||
fieldsData = pack(point);
|
fieldsData = pack(point);
|
||||||
}
|
}
|
||||||
|
@ -97,8 +97,8 @@ public final class FloatPoint extends Field {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Number numericValue() {
|
public Number numericValue() {
|
||||||
if (type.pointDataDimensionCount() != 1) {
|
if (type.pointDimensionCount() != 1) {
|
||||||
throw new IllegalStateException("this field (name=" + name + ") uses " + type.pointDataDimensionCount() + " dimensions; cannot convert to a single numeric value");
|
throw new IllegalStateException("this field (name=" + name + ") uses " + type.pointDimensionCount() + " dimensions; cannot convert to a single numeric value");
|
||||||
}
|
}
|
||||||
BytesRef bytes = (BytesRef) fieldsData;
|
BytesRef bytes = (BytesRef) fieldsData;
|
||||||
assert bytes.length == Float.BYTES;
|
assert bytes.length == Float.BYTES;
|
||||||
|
@ -147,7 +147,7 @@ public final class FloatPoint extends Field {
|
||||||
result.append(':');
|
result.append(':');
|
||||||
|
|
||||||
BytesRef bytes = (BytesRef) fieldsData;
|
BytesRef bytes = (BytesRef) fieldsData;
|
||||||
for (int dim = 0; dim < type.pointDataDimensionCount(); dim++) {
|
for (int dim = 0; dim < type.pointDimensionCount(); dim++) {
|
||||||
if (dim > 0) {
|
if (dim > 0) {
|
||||||
result.append(',');
|
result.append(',');
|
||||||
}
|
}
|
||||||
|
|
|
@ -78,8 +78,8 @@ public class FloatRange extends Field {
|
||||||
*/
|
*/
|
||||||
public void setRangeValues(float[] min, float[] max) {
|
public void setRangeValues(float[] min, float[] max) {
|
||||||
checkArgs(min, max);
|
checkArgs(min, max);
|
||||||
if (min.length*2 != type.pointDataDimensionCount() || max.length*2 != type.pointDataDimensionCount()) {
|
if (min.length*2 != type.pointDimensionCount() || max.length*2 != type.pointDimensionCount()) {
|
||||||
throw new IllegalArgumentException("field (name=" + name + ") uses " + type.pointDataDimensionCount()/2
|
throw new IllegalArgumentException("field (name=" + name + ") uses " + type.pointDimensionCount()/2
|
||||||
+ " dimensions; cannot change to (incoming) " + min.length + " dimensions");
|
+ " dimensions; cannot change to (incoming) " + min.length + " dimensions");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -149,7 +149,7 @@ public class FloatRange extends Field {
|
||||||
* @return the decoded min value
|
* @return the decoded min value
|
||||||
*/
|
*/
|
||||||
public float getMin(int dimension) {
|
public float getMin(int dimension) {
|
||||||
Objects.checkIndex(dimension, type.pointDataDimensionCount()/2);
|
Objects.checkIndex(dimension, type.pointDimensionCount()/2);
|
||||||
return decodeMin(((BytesRef)fieldsData).bytes, dimension);
|
return decodeMin(((BytesRef)fieldsData).bytes, dimension);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -159,7 +159,7 @@ public class FloatRange extends Field {
|
||||||
* @return the decoded max value
|
* @return the decoded max value
|
||||||
*/
|
*/
|
||||||
public float getMax(int dimension) {
|
public float getMax(int dimension) {
|
||||||
Objects.checkIndex(dimension, type.pointDataDimensionCount()/2);
|
Objects.checkIndex(dimension, type.pointDimensionCount()/2);
|
||||||
return decodeMax(((BytesRef)fieldsData).bytes, dimension);
|
return decodeMax(((BytesRef)fieldsData).bytes, dimension);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -245,7 +245,7 @@ public class FloatRange extends Field {
|
||||||
sb.append(':');
|
sb.append(':');
|
||||||
byte[] b = ((BytesRef)fieldsData).bytes;
|
byte[] b = ((BytesRef)fieldsData).bytes;
|
||||||
toString(b, 0);
|
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(' ');
|
||||||
sb.append(toString(b, d));
|
sb.append(toString(b, d));
|
||||||
}
|
}
|
||||||
|
|
|
@ -58,8 +58,8 @@ public final class IntPoint extends Field {
|
||||||
|
|
||||||
/** Change the values of this field */
|
/** Change the values of this field */
|
||||||
public void setIntValues(int... point) {
|
public void setIntValues(int... point) {
|
||||||
if (type.pointDataDimensionCount() != point.length) {
|
if (type.pointDimensionCount() != point.length) {
|
||||||
throw new IllegalArgumentException("this field (name=" + name + ") uses " + type.pointDataDimensionCount() + " dimensions; cannot change to (incoming) " + point.length + " dimensions");
|
throw new IllegalArgumentException("this field (name=" + name + ") uses " + type.pointDimensionCount() + " dimensions; cannot change to (incoming) " + point.length + " dimensions");
|
||||||
}
|
}
|
||||||
fieldsData = pack(point);
|
fieldsData = pack(point);
|
||||||
}
|
}
|
||||||
|
@ -71,8 +71,8 @@ public final class IntPoint extends Field {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Number numericValue() {
|
public Number numericValue() {
|
||||||
if (type.pointDataDimensionCount() != 1) {
|
if (type.pointDimensionCount() != 1) {
|
||||||
throw new IllegalStateException("this field (name=" + name + ") uses " + type.pointDataDimensionCount() + " dimensions; cannot convert to a single numeric value");
|
throw new IllegalStateException("this field (name=" + name + ") uses " + type.pointDimensionCount() + " dimensions; cannot convert to a single numeric value");
|
||||||
}
|
}
|
||||||
BytesRef bytes = (BytesRef) fieldsData;
|
BytesRef bytes = (BytesRef) fieldsData;
|
||||||
assert bytes.length == Integer.BYTES;
|
assert bytes.length == Integer.BYTES;
|
||||||
|
@ -121,7 +121,7 @@ public final class IntPoint extends Field {
|
||||||
result.append(':');
|
result.append(':');
|
||||||
|
|
||||||
BytesRef bytes = (BytesRef) fieldsData;
|
BytesRef bytes = (BytesRef) fieldsData;
|
||||||
for (int dim = 0; dim < type.pointDataDimensionCount(); dim++) {
|
for (int dim = 0; dim < type.pointDimensionCount(); dim++) {
|
||||||
if (dim > 0) {
|
if (dim > 0) {
|
||||||
result.append(',');
|
result.append(',');
|
||||||
}
|
}
|
||||||
|
|
|
@ -78,8 +78,8 @@ public class IntRange extends Field {
|
||||||
*/
|
*/
|
||||||
public void setRangeValues(int[] min, int[] max) {
|
public void setRangeValues(int[] min, int[] max) {
|
||||||
checkArgs(min, max);
|
checkArgs(min, max);
|
||||||
if (min.length*2 != type.pointDataDimensionCount() || max.length*2 != type.pointDataDimensionCount()) {
|
if (min.length*2 != type.pointDimensionCount() || max.length*2 != type.pointDimensionCount()) {
|
||||||
throw new IllegalArgumentException("field (name=" + name + ") uses " + type.pointDataDimensionCount()/2
|
throw new IllegalArgumentException("field (name=" + name + ") uses " + type.pointDimensionCount()/2
|
||||||
+ " dimensions; cannot change to (incoming) " + min.length + " dimensions");
|
+ " dimensions; cannot change to (incoming) " + min.length + " dimensions");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -149,7 +149,7 @@ public class IntRange extends Field {
|
||||||
* @return the decoded min value
|
* @return the decoded min value
|
||||||
*/
|
*/
|
||||||
public int getMin(int dimension) {
|
public int getMin(int dimension) {
|
||||||
Objects.checkIndex(dimension, type.pointDataDimensionCount()/2);
|
Objects.checkIndex(dimension, type.pointDimensionCount()/2);
|
||||||
return decodeMin(((BytesRef)fieldsData).bytes, dimension);
|
return decodeMin(((BytesRef)fieldsData).bytes, dimension);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -159,7 +159,7 @@ public class IntRange extends Field {
|
||||||
* @return the decoded max value
|
* @return the decoded max value
|
||||||
*/
|
*/
|
||||||
public int getMax(int dimension) {
|
public int getMax(int dimension) {
|
||||||
Objects.checkIndex(dimension, type.pointDataDimensionCount()/2);
|
Objects.checkIndex(dimension, type.pointDimensionCount()/2);
|
||||||
return decodeMax(((BytesRef)fieldsData).bytes, dimension);
|
return decodeMax(((BytesRef)fieldsData).bytes, dimension);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -245,7 +245,7 @@ public class IntRange extends Field {
|
||||||
sb.append(':');
|
sb.append(':');
|
||||||
byte[] b = ((BytesRef)fieldsData).bytes;
|
byte[] b = ((BytesRef)fieldsData).bytes;
|
||||||
toString(b, 0);
|
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(' ');
|
||||||
sb.append(toString(b, d));
|
sb.append(toString(b, d));
|
||||||
}
|
}
|
||||||
|
|
|
@ -147,9 +147,9 @@ public class LatLonPoint extends Field {
|
||||||
/** helper: checks a fieldinfo and throws exception if its definitely not a LatLonPoint */
|
/** helper: checks a fieldinfo and throws exception if its definitely not a LatLonPoint */
|
||||||
static void checkCompatible(FieldInfo fieldInfo) {
|
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.
|
// 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()) {
|
if (fieldInfo.getPointDimensionCount() != 0 && fieldInfo.getPointDimensionCount() != TYPE.pointDimensionCount()) {
|
||||||
throw new IllegalArgumentException("field=\"" + fieldInfo.name + "\" was indexed with numDims=" + fieldInfo.getPointDataDimensionCount() +
|
throw new IllegalArgumentException("field=\"" + fieldInfo.name + "\" was indexed with numDims=" + fieldInfo.getPointDimensionCount() +
|
||||||
" but this point type has numDims=" + TYPE.pointDataDimensionCount() +
|
" but this point type has numDims=" + TYPE.pointDimensionCount() +
|
||||||
", is the field really a LatLonPoint?");
|
", is the field really a LatLonPoint?");
|
||||||
}
|
}
|
||||||
if (fieldInfo.getPointNumBytes() != 0 && fieldInfo.getPointNumBytes() != TYPE.pointNumBytes()) {
|
if (fieldInfo.getPointNumBytes() != 0 && fieldInfo.getPointNumBytes() != TYPE.pointNumBytes()) {
|
||||||
|
|
|
@ -61,8 +61,8 @@ public final class LongPoint extends Field {
|
||||||
|
|
||||||
/** Change the values of this field */
|
/** Change the values of this field */
|
||||||
public void setLongValues(long... point) {
|
public void setLongValues(long... point) {
|
||||||
if (type.pointDataDimensionCount() != point.length) {
|
if (type.pointDimensionCount() != point.length) {
|
||||||
throw new IllegalArgumentException("this field (name=" + name + ") uses " + type.pointDataDimensionCount() + " dimensions; cannot change to (incoming) " + point.length + " dimensions");
|
throw new IllegalArgumentException("this field (name=" + name + ") uses " + type.pointDimensionCount() + " dimensions; cannot change to (incoming) " + point.length + " dimensions");
|
||||||
}
|
}
|
||||||
fieldsData = pack(point);
|
fieldsData = pack(point);
|
||||||
}
|
}
|
||||||
|
@ -74,8 +74,8 @@ public final class LongPoint extends Field {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Number numericValue() {
|
public Number numericValue() {
|
||||||
if (type.pointDataDimensionCount() != 1) {
|
if (type.pointDimensionCount() != 1) {
|
||||||
throw new IllegalStateException("this field (name=" + name + ") uses " + type.pointDataDimensionCount() + " dimensions; cannot convert to a single numeric value");
|
throw new IllegalStateException("this field (name=" + name + ") uses " + type.pointDimensionCount() + " dimensions; cannot convert to a single numeric value");
|
||||||
}
|
}
|
||||||
BytesRef bytes = (BytesRef) fieldsData;
|
BytesRef bytes = (BytesRef) fieldsData;
|
||||||
assert bytes.length == Long.BYTES;
|
assert bytes.length == Long.BYTES;
|
||||||
|
@ -124,7 +124,7 @@ public final class LongPoint extends Field {
|
||||||
result.append(':');
|
result.append(':');
|
||||||
|
|
||||||
BytesRef bytes = (BytesRef) fieldsData;
|
BytesRef bytes = (BytesRef) fieldsData;
|
||||||
for (int dim = 0; dim < type.pointDataDimensionCount(); dim++) {
|
for (int dim = 0; dim < type.pointDimensionCount(); dim++) {
|
||||||
if (dim > 0) {
|
if (dim > 0) {
|
||||||
result.append(',');
|
result.append(',');
|
||||||
}
|
}
|
||||||
|
|
|
@ -78,8 +78,8 @@ public class LongRange extends Field {
|
||||||
*/
|
*/
|
||||||
public void setRangeValues(long[] min, long[] max) {
|
public void setRangeValues(long[] min, long[] max) {
|
||||||
checkArgs(min, max);
|
checkArgs(min, max);
|
||||||
if (min.length*2 != type.pointDataDimensionCount() || max.length*2 != type.pointDataDimensionCount()) {
|
if (min.length*2 != type.pointDimensionCount() || max.length*2 != type.pointDimensionCount()) {
|
||||||
throw new IllegalArgumentException("field (name=" + name + ") uses " + type.pointDataDimensionCount()/2
|
throw new IllegalArgumentException("field (name=" + name + ") uses " + type.pointDimensionCount()/2
|
||||||
+ " dimensions; cannot change to (incoming) " + min.length + " dimensions");
|
+ " dimensions; cannot change to (incoming) " + min.length + " dimensions");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -147,7 +147,7 @@ public class LongRange extends Field {
|
||||||
* @return the decoded min value
|
* @return the decoded min value
|
||||||
*/
|
*/
|
||||||
public long getMin(int dimension) {
|
public long getMin(int dimension) {
|
||||||
Objects.checkIndex(dimension, type.pointDataDimensionCount()/2);
|
Objects.checkIndex(dimension, type.pointDimensionCount()/2);
|
||||||
return decodeMin(((BytesRef)fieldsData).bytes, dimension);
|
return decodeMin(((BytesRef)fieldsData).bytes, dimension);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -157,7 +157,7 @@ public class LongRange extends Field {
|
||||||
* @return the decoded max value
|
* @return the decoded max value
|
||||||
*/
|
*/
|
||||||
public long getMax(int dimension) {
|
public long getMax(int dimension) {
|
||||||
Objects.checkIndex(dimension, type.pointDataDimensionCount()/2);
|
Objects.checkIndex(dimension, type.pointDimensionCount()/2);
|
||||||
return decodeMax(((BytesRef)fieldsData).bytes, dimension);
|
return decodeMax(((BytesRef)fieldsData).bytes, dimension);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -243,7 +243,7 @@ public class LongRange extends Field {
|
||||||
sb.append(':');
|
sb.append(':');
|
||||||
byte[] b = ((BytesRef)fieldsData).bytes;
|
byte[] b = ((BytesRef)fieldsData).bytes;
|
||||||
toString(b, 0);
|
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(' ');
|
||||||
sb.append(toString(b, d));
|
sb.append(toString(b, d));
|
||||||
}
|
}
|
||||||
|
|
|
@ -255,9 +255,9 @@ abstract class RangeFieldQuery extends Query {
|
||||||
|
|
||||||
/** Check indexed field info against the provided query data. */
|
/** Check indexed field info against the provided query data. */
|
||||||
private void checkFieldInfo(FieldInfo fieldInfo) {
|
private void checkFieldInfo(FieldInfo fieldInfo) {
|
||||||
if (fieldInfo.getPointDataDimensionCount()/2 != numDims) {
|
if (fieldInfo.getPointDimensionCount()/2 != numDims) {
|
||||||
throw new IllegalArgumentException("field=\"" + field + "\" was indexed with 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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1902,7 +1902,7 @@ public final class CheckIndex implements Closeable {
|
||||||
throw new RuntimeException("there are fields with points, but reader.getPointsReader() is null");
|
throw new RuntimeException("there are fields with points, but reader.getPointsReader() is null");
|
||||||
}
|
}
|
||||||
for (FieldInfo fieldInfo : fieldInfos) {
|
for (FieldInfo fieldInfo : fieldInfos) {
|
||||||
if (fieldInfo.getPointDataDimensionCount() > 0) {
|
if (fieldInfo.getPointDimensionCount() > 0) {
|
||||||
PointValues values = pointsReader.getValues(fieldInfo.name);
|
PointValues values = pointsReader.getValues(fieldInfo.name);
|
||||||
if (values == null) {
|
if (values == null) {
|
||||||
continue;
|
continue;
|
||||||
|
@ -1982,7 +1982,7 @@ public final class CheckIndex implements Closeable {
|
||||||
public VerifyPointsVisitor(String fieldName, int maxDoc, PointValues values) throws IOException {
|
public VerifyPointsVisitor(String fieldName, int maxDoc, PointValues values) throws IOException {
|
||||||
this.maxDoc = maxDoc;
|
this.maxDoc = maxDoc;
|
||||||
this.fieldName = fieldName;
|
this.fieldName = fieldName;
|
||||||
numDataDims = values.getNumDataDimensions();
|
numDataDims = values.getNumDimensions();
|
||||||
numIndexDims = values.getNumIndexDimensions();
|
numIndexDims = values.getNumIndexDimensions();
|
||||||
bytesPerDim = values.getBytesPerDimension();
|
bytesPerDim = values.getBytesPerDimension();
|
||||||
packedBytesCount = numDataDims * bytesPerDim;
|
packedBytesCount = numDataDims * bytesPerDim;
|
||||||
|
|
|
@ -194,7 +194,7 @@ public abstract class CodecReader extends LeafReader implements Accountable {
|
||||||
public final PointValues getPointValues(String field) throws IOException {
|
public final PointValues getPointValues(String field) throws IOException {
|
||||||
ensureOpen();
|
ensureOpen();
|
||||||
FieldInfo fi = getFieldInfos().fieldInfo(field);
|
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 points
|
// Field does not exist or does not index points
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
|
@ -202,7 +202,7 @@ final class DefaultIndexingChain extends DocConsumer {
|
||||||
PerField perField = fieldHash[i];
|
PerField perField = fieldHash[i];
|
||||||
while (perField != null) {
|
while (perField != null) {
|
||||||
if (perField.pointValuesWriter != null) {
|
if (perField.pointValuesWriter != null) {
|
||||||
if (perField.fieldInfo.getPointDataDimensionCount() == 0) {
|
if (perField.fieldInfo.getPointDimensionCount() == 0) {
|
||||||
// BUG
|
// BUG
|
||||||
throw new AssertionError("segment=" + state.segmentInfo + ": field=\"" + perField.fieldInfo.name + "\" has no points but wrote them");
|
throw 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.flush(state, sortMap, pointsWriter);
|
||||||
perField.pointValuesWriter = null;
|
perField.pointValuesWriter = null;
|
||||||
} else if (perField.fieldInfo.getPointDataDimensionCount() != 0) {
|
} else if (perField.fieldInfo.getPointDimensionCount() != 0) {
|
||||||
// BUG
|
// BUG
|
||||||
throw new AssertionError("segment=" + state.segmentInfo + ": field=\"" + perField.fieldInfo.name + "\" has points but did not write them");
|
throw 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);
|
indexDocValue(fp, dvType, field);
|
||||||
}
|
}
|
||||||
if (fieldType.pointDataDimensionCount() != 0) {
|
if (fieldType.pointDimensionCount() != 0) {
|
||||||
if (fp == null) {
|
if (fp == null) {
|
||||||
fp = getOrAddField(fieldName, fieldType, false);
|
fp = getOrAddField(fieldName, fieldType, false);
|
||||||
}
|
}
|
||||||
|
@ -509,18 +509,18 @@ final class DefaultIndexingChain extends DocConsumer {
|
||||||
|
|
||||||
/** Called from processDocument to index one field's point */
|
/** Called from processDocument to index one field's point */
|
||||||
private void indexPoint(PerField fp, IndexableField field) throws IOException {
|
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 pointIndexDimensionCount = field.fieldType().pointIndexDimensionCount();
|
||||||
|
|
||||||
int dimensionNumBytes = field.fieldType().pointNumBytes();
|
int dimensionNumBytes = field.fieldType().pointNumBytes();
|
||||||
|
|
||||||
// Record dimensions for this field; this setter will throw IllegalArgExc if
|
// Record dimensions for this field; this setter will throw IllegalArgExc if
|
||||||
// the dimensions were already set to something different:
|
// the dimensions were already set to something different:
|
||||||
if (fp.fieldInfo.getPointDataDimensionCount() == 0) {
|
if (fp.fieldInfo.getPointDimensionCount() == 0) {
|
||||||
fieldInfos.globalFieldNumbers.setDimensions(fp.fieldInfo.number, fp.fieldInfo.name, pointDataDimensionCount, pointIndexDimensionCount, dimensionNumBytes);
|
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) {
|
if (fp.pointValuesWriter == null) {
|
||||||
fp.pointValuesWriter = new PointValuesWriter(docWriter, fp.fieldInfo);
|
fp.pointValuesWriter = new PointValuesWriter(docWriter, fp.fieldInfo);
|
||||||
|
|
|
@ -376,9 +376,9 @@ public class ExitableDirectoryReader extends FilterDirectoryReader {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getNumDataDimensions() throws IOException {
|
public int getNumDimensions() throws IOException {
|
||||||
checkAndThrow();
|
checkAndThrow();
|
||||||
return in.getNumDataDimensions();
|
return in.getNumDimensions();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -50,7 +50,7 @@ public final class FieldInfo {
|
||||||
|
|
||||||
/** If both of these are positive it means this field indexed points
|
/** If both of these are positive it means this field indexed points
|
||||||
* (see {@link org.apache.lucene.codecs.PointsFormat}). */
|
* (see {@link org.apache.lucene.codecs.PointsFormat}). */
|
||||||
private int pointDataDimensionCount;
|
private int pointDimensionCount;
|
||||||
private int pointIndexDimensionCount;
|
private int pointIndexDimensionCount;
|
||||||
private int pointNumBytes;
|
private int pointNumBytes;
|
||||||
|
|
||||||
|
@ -64,7 +64,7 @@ public final class FieldInfo {
|
||||||
*/
|
*/
|
||||||
public FieldInfo(String name, int number, boolean storeTermVector, boolean omitNorms, boolean storePayloads,
|
public FieldInfo(String name, int number, boolean storeTermVector, boolean omitNorms, boolean storePayloads,
|
||||||
IndexOptions indexOptions, DocValuesType docValues, long dvGen, Map<String,String> attributes,
|
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.name = Objects.requireNonNull(name);
|
||||||
this.number = number;
|
this.number = number;
|
||||||
this.docValuesType = Objects.requireNonNull(docValues, "DocValuesType must not be null (field: \"" + name + "\")");
|
this.docValuesType = Objects.requireNonNull(docValues, "DocValuesType must not be null (field: \"" + name + "\")");
|
||||||
|
@ -80,7 +80,7 @@ public final class FieldInfo {
|
||||||
}
|
}
|
||||||
this.dvGen = dvGen;
|
this.dvGen = dvGen;
|
||||||
this.attributes = Objects.requireNonNull(attributes);
|
this.attributes = Objects.requireNonNull(attributes);
|
||||||
this.pointDataDimensionCount = pointDataDimensionCount;
|
this.pointDimensionCount = pointDimensionCount;
|
||||||
this.pointIndexDimensionCount = pointIndexDimensionCount;
|
this.pointIndexDimensionCount = pointIndexDimensionCount;
|
||||||
this.pointNumBytes = pointNumBytes;
|
this.pointNumBytes = pointNumBytes;
|
||||||
this.softDeletesField = softDeletesField;
|
this.softDeletesField = softDeletesField;
|
||||||
|
@ -109,8 +109,8 @@ public final class FieldInfo {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pointDataDimensionCount < 0) {
|
if (pointDimensionCount < 0) {
|
||||||
throw new IllegalStateException("pointDataDimensionCount must be >= 0; got " + pointDataDimensionCount);
|
throw new IllegalStateException("pointDimensionCount must be >= 0; got " + pointDimensionCount);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pointIndexDimensionCount < 0) {
|
if (pointIndexDimensionCount < 0) {
|
||||||
|
@ -121,16 +121,16 @@ public final class FieldInfo {
|
||||||
throw new IllegalStateException("pointNumBytes must be >= 0; got " + pointNumBytes);
|
throw new IllegalStateException("pointNumBytes must be >= 0; got " + pointNumBytes);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pointDataDimensionCount != 0 && pointNumBytes == 0) {
|
if (pointDimensionCount != 0 && pointNumBytes == 0) {
|
||||||
throw new IllegalStateException("pointNumBytes must be > 0 when pointDataDimensionCount=" + pointDataDimensionCount);
|
throw new IllegalStateException("pointNumBytes must be > 0 when pointDimensionCount=" + pointDimensionCount);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pointIndexDimensionCount != 0 && pointDataDimensionCount == 0) {
|
if (pointIndexDimensionCount != 0 && pointDimensionCount == 0) {
|
||||||
throw new IllegalStateException("pointIndexDimensionCount must be 0 when pointDataDimensionCount=0");
|
throw new IllegalStateException("pointIndexDimensionCount must be 0 when pointDimensionCount=0");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pointNumBytes != 0 && pointDataDimensionCount == 0) {
|
if (pointNumBytes != 0 && pointDimensionCount == 0) {
|
||||||
throw new IllegalStateException("pointDataDimensionCount must be > 0 when pointNumBytes=" + pointNumBytes);
|
throw new IllegalStateException("pointDimensionCount must be > 0 when pointNumBytes=" + pointNumBytes);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (dvGen != -1 && docValuesType == DocValuesType.NONE) {
|
if (dvGen != -1 && docValuesType == DocValuesType.NONE) {
|
||||||
|
@ -142,7 +142,7 @@ public final class FieldInfo {
|
||||||
|
|
||||||
// should only be called by FieldInfos#addOrUpdate
|
// should only be called by FieldInfos#addOrUpdate
|
||||||
void update(boolean storeTermVector, boolean omitNorms, boolean storePayloads, IndexOptions indexOptions,
|
void 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) {
|
if (indexOptions == null) {
|
||||||
throw new NullPointerException("IndexOptions must not be null (field: \"" + name + "\")");
|
throw new NullPointerException("IndexOptions must not be null (field: \"" + name + "\")");
|
||||||
}
|
}
|
||||||
|
@ -155,12 +155,12 @@ public final class FieldInfo {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.pointDataDimensionCount == 0 && dataDimensionCount != 0) {
|
if (this.pointDimensionCount == 0 && dimensionCount != 0) {
|
||||||
this.pointDataDimensionCount = dataDimensionCount;
|
this.pointDimensionCount = dimensionCount;
|
||||||
this.pointIndexDimensionCount = indexDimensionCount;
|
this.pointIndexDimensionCount = indexDimensionCount;
|
||||||
this.pointNumBytes = dimensionNumBytes;
|
this.pointNumBytes = dimensionNumBytes;
|
||||||
} else if (dataDimensionCount != 0 && (this.pointDataDimensionCount != dataDimensionCount || this.pointIndexDimensionCount != indexDimensionCount || this.pointNumBytes != dimensionNumBytes)) {
|
} else if (dimensionCount != 0 && (this.pointDimensionCount != dimensionCount || 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);
|
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
|
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
|
/** Record that this field is indexed with points, with the
|
||||||
* specified number of dimensions and bytes per dimension. */
|
* specified number of dimensions and bytes per dimension. */
|
||||||
public void setPointDimensions(int dataDimensionCount, int indexDimensionCount, int numBytes) {
|
public void setPointDimensions(int dimensionCount, int indexDimensionCount, int numBytes) {
|
||||||
if (dataDimensionCount <= 0) {
|
if (dimensionCount <= 0) {
|
||||||
throw new IllegalArgumentException("point data dimension count must be >= 0; got " + dataDimensionCount + " for field=\"" + name + "\"");
|
throw new IllegalArgumentException("point dimension count must be >= 0; got " + dimensionCount + " for field=\"" + name + "\"");
|
||||||
}
|
}
|
||||||
if (dataDimensionCount > PointValues.MAX_DIMENSIONS) {
|
if (indexDimensionCount > PointValues.MAX_INDEX_DIMENSIONS) {
|
||||||
throw new IllegalArgumentException("point data dimension count must be < PointValues.MAX_DIMENSIONS (= " + PointValues.MAX_DIMENSIONS + "); got " + dataDimensionCount + " for field=\"" + name + "\"");
|
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) {
|
if (indexDimensionCount > dimensionCount) {
|
||||||
throw new IllegalArgumentException("point index dimension count must be <= point data dimension count (= " + dataDimensionCount + "); got " + indexDimensionCount + " for field=\"" + name + "\"");
|
throw new IllegalArgumentException("point index dimension count must be <= point dimension count (= " + dimensionCount + "); got " + indexDimensionCount + " for field=\"" + name + "\"");
|
||||||
}
|
}
|
||||||
if (numBytes <= 0) {
|
if (numBytes <= 0) {
|
||||||
throw new IllegalArgumentException("point numBytes must be >= 0; got " + numBytes + " for field=\"" + name + "\"");
|
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) {
|
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 + "\"");
|
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) {
|
if (pointDimensionCount != 0 && pointDimensionCount != dimensionCount) {
|
||||||
throw new IllegalArgumentException("cannot change point data dimension count from " + pointDataDimensionCount + " to " + dataDimensionCount + " for field=\"" + name + "\"");
|
throw new IllegalArgumentException("cannot change point dimension count from " + pointDimensionCount + " to " + dimensionCount + " for field=\"" + name + "\"");
|
||||||
}
|
}
|
||||||
if (pointIndexDimensionCount != 0 && pointIndexDimensionCount != indexDimensionCount) {
|
if (pointIndexDimensionCount != 0 && pointIndexDimensionCount != indexDimensionCount) {
|
||||||
throw new IllegalArgumentException("cannot change point index dimension count from " + pointIndexDimensionCount + " to " + indexDimensionCount + " for field=\"" + name + "\"");
|
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 + "\"");
|
throw new IllegalArgumentException("cannot change point numBytes from " + pointNumBytes + " to " + numBytes + " for field=\"" + name + "\"");
|
||||||
}
|
}
|
||||||
|
|
||||||
pointDataDimensionCount = dataDimensionCount;
|
pointDimensionCount = dimensionCount;
|
||||||
pointIndexDimensionCount = indexDimensionCount;
|
pointIndexDimensionCount = indexDimensionCount;
|
||||||
pointNumBytes = numBytes;
|
pointNumBytes = numBytes;
|
||||||
|
|
||||||
|
@ -218,8 +218,8 @@ public final class FieldInfo {
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Return point data dimension count */
|
/** Return point data dimension count */
|
||||||
public int getPointDataDimensionCount() {
|
public int getPointDimensionCount() {
|
||||||
return pointDataDimensionCount;
|
return pointDimensionCount;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Return point data dimension count */
|
/** Return point data dimension count */
|
||||||
|
|
|
@ -98,7 +98,7 @@ public class FieldInfos implements Iterable<FieldInfo> {
|
||||||
hasNorms |= info.hasNorms();
|
hasNorms |= info.hasNorms();
|
||||||
hasDocValues |= info.getDocValuesType() != DocValuesType.NONE;
|
hasDocValues |= info.getDocValuesType() != DocValuesType.NONE;
|
||||||
hasPayloads |= info.hasPayloads();
|
hasPayloads |= info.hasPayloads();
|
||||||
hasPointValues |= (info.getPointDataDimensionCount() != 0);
|
hasPointValues |= (info.getPointDimensionCount() != 0);
|
||||||
if (info.isSoftDeletesField()) {
|
if (info.isSoftDeletesField()) {
|
||||||
if (softDeletesField != null && softDeletesField.equals(info.name) == false) {
|
if (softDeletesField != null && softDeletesField.equals(info.name) == false) {
|
||||||
throw new IllegalArgumentException("multiple soft-deletes fields [" + info.name + ", " + softDeletesField + "]");
|
throw new IllegalArgumentException("multiple soft-deletes fields [" + info.name + ", " + softDeletesField + "]");
|
||||||
|
@ -251,12 +251,12 @@ public class FieldInfos implements Iterable<FieldInfo> {
|
||||||
}
|
}
|
||||||
|
|
||||||
static final class FieldDimensions {
|
static final class FieldDimensions {
|
||||||
public final int dataDimensionCount;
|
public final int dimensionCount;
|
||||||
public final int indexDimensionCount;
|
public final int indexDimensionCount;
|
||||||
public final int dimensionNumBytes;
|
public final int dimensionNumBytes;
|
||||||
|
|
||||||
public FieldDimensions(int dataDimensionCount, int indexDimensionCount, int dimensionNumBytes) {
|
public FieldDimensions(int dimensionCount, int indexDimensionCount, int dimensionNumBytes) {
|
||||||
this.dataDimensionCount = dataDimensionCount;
|
this.dimensionCount = dimensionCount;
|
||||||
this.indexDimensionCount = indexDimensionCount;
|
this.indexDimensionCount = indexDimensionCount;
|
||||||
this.dimensionNumBytes = dimensionNumBytes;
|
this.dimensionNumBytes = dimensionNumBytes;
|
||||||
}
|
}
|
||||||
|
@ -297,7 +297,7 @@ public class FieldInfos implements Iterable<FieldInfo> {
|
||||||
* number assigned if possible otherwise the first unassigned field number
|
* number assigned if possible otherwise the first unassigned field number
|
||||||
* is used as the 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) {
|
if (indexOptions != IndexOptions.NONE) {
|
||||||
IndexOptions currentOpts = this.indexOptions.get(fieldName);
|
IndexOptions currentOpts = this.indexOptions.get(fieldName);
|
||||||
if (currentOpts == null) {
|
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 + "\"");
|
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);
|
FieldDimensions dims = dimensions.get(fieldName);
|
||||||
if (dims != null) {
|
if (dims != null) {
|
||||||
if (dims.dataDimensionCount != dataDimensionCount) {
|
if (dims.dimensionCount != dimensionCount) {
|
||||||
throw new IllegalArgumentException("cannot change point data dimension count from " + dims.dataDimensionCount + " to " + dataDimensionCount + " for field=\"" + fieldName + "\"");
|
throw new IllegalArgumentException("cannot change point dimension count from " + dims.dimensionCount + " to " + dimensionCount + " for field=\"" + fieldName + "\"");
|
||||||
}
|
}
|
||||||
if (dims.indexDimensionCount != indexDimensionCount) {
|
if (dims.indexDimensionCount != indexDimensionCount) {
|
||||||
throw new IllegalArgumentException("cannot change point index dimension count from " + dims.indexDimensionCount + " to " + indexDimensionCount + " for field=\"" + fieldName + "\"");
|
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 + "\"");
|
throw new IllegalArgumentException("cannot change point numBytes from " + dims.dimensionNumBytes + " to " + dimensionNumBytes + " for field=\"" + fieldName + "\"");
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
dimensions.put(fieldName, new FieldDimensions(dataDimensionCount, indexDimensionCount, dimensionNumBytes));
|
dimensions.put(fieldName, new FieldDimensions(dimensionCount, indexDimensionCount, dimensionNumBytes));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Integer fieldNumber = nameToNumber.get(fieldName);
|
Integer fieldNumber = nameToNumber.get(fieldName);
|
||||||
|
@ -396,8 +396,8 @@ public class FieldInfos implements Iterable<FieldInfo> {
|
||||||
}
|
}
|
||||||
FieldDimensions dim = dimensions.get(name);
|
FieldDimensions dim = dimensions.get(name);
|
||||||
if (dim != null) {
|
if (dim != null) {
|
||||||
if (dim.dataDimensionCount != dataDimensionCount) {
|
if (dim.dimensionCount != dataDimensionCount) {
|
||||||
throw new IllegalArgumentException("cannot change point data dimension count from " + dim.dataDimensionCount + " to " + dataDimensionCount + " for field=\"" + name + "\"");
|
throw new IllegalArgumentException("cannot change point dimension count from " + dim.dimensionCount + " to " + dataDimensionCount + " for field=\"" + name + "\"");
|
||||||
}
|
}
|
||||||
if (dim.indexDimensionCount != indexDimensionCount) {
|
if (dim.indexDimensionCount != indexDimensionCount) {
|
||||||
throw new IllegalArgumentException("cannot change point index dimension count from " + dim.indexDimensionCount + " to " + indexDimensionCount + " for field=\"" + name + "\"");
|
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);
|
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) {
|
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 + "\"");
|
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) {
|
if (indexDimensionCount > dimensionCount) {
|
||||||
throw new IllegalArgumentException("pointDataDimensionCount must be <= PointValues.MAX_DIMENSIONS (= " + PointValues.MAX_DIMENSIONS + "); got " + dataDimensionCount + " for field=\"" + name + "\"");
|
throw new IllegalArgumentException("indexDimensionCount must be <= dimensionCount (= " + dimensionCount + "); got " + indexDimensionCount + " for field=\"" + name + "\"");
|
||||||
}
|
}
|
||||||
if (indexDimensionCount > dataDimensionCount) {
|
if (indexDimensionCount > PointValues.MAX_INDEX_DIMENSIONS) {
|
||||||
throw new IllegalArgumentException("pointIndexDimensionCount must be <= pointDataDimensionCount (= " + dataDimensionCount + "); got " + indexDimensionCount + " for field=\"" + name + "\"");
|
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);
|
verifyConsistentDimensions(number, name, dimensionCount, indexDimensionCount, dimensionNumBytes);
|
||||||
dimensions.put(name, new FieldDimensions(dataDimensionCount, 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.omitsNorms(), fi.hasPayloads(),
|
||||||
fi.getIndexOptions(), fi.getDocValuesType(), dvGen,
|
fi.getIndexOptions(), fi.getDocValuesType(), dvGen,
|
||||||
fi.attributes(),
|
fi.attributes(),
|
||||||
fi.getPointDataDimensionCount(), fi.getPointIndexDimensionCount(), fi.getPointNumBytes(),
|
fi.getPointDimensionCount(), fi.getPointIndexDimensionCount(), fi.getPointNumBytes(),
|
||||||
fi.isSoftDeletesField());
|
fi.isSoftDeletesField());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -992,7 +992,7 @@ public class IndexWriter implements Closeable, TwoPhaseCommit, Accountable,
|
||||||
for(SegmentCommitInfo info : segmentInfos) {
|
for(SegmentCommitInfo info : segmentInfos) {
|
||||||
FieldInfos fis = readFieldInfos(info);
|
FieldInfos fis = readFieldInfos(info);
|
||||||
for(FieldInfo fi : fis) {
|
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);
|
FieldInfos fis = readFieldInfos(info);
|
||||||
for(FieldInfo fi : fis) {
|
for(FieldInfo fi : fis) {
|
||||||
// This will throw exceptions if any of the incoming fields have an illegal schema change:
|
// 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));
|
infos.add(copySegmentAsIs(info, newSegName, context));
|
||||||
}
|
}
|
||||||
|
|
|
@ -100,9 +100,9 @@ public interface IndexableFieldType {
|
||||||
public DocValuesType docValuesType();
|
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 key
|
* The number of dimensions used for the index key
|
||||||
|
|
|
@ -89,6 +89,9 @@ public abstract class PointValues {
|
||||||
/** Maximum number of dimensions */
|
/** Maximum number of dimensions */
|
||||||
public static final int MAX_DIMENSIONS = BKDWriter.MAX_DIMS;
|
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
|
/** Return the cumulated number of points across all leaves of the given
|
||||||
* {@link IndexReader}. Leaves that do not have points for the given field
|
* {@link IndexReader}. Leaves that do not have points for the given field
|
||||||
* are ignored.
|
* 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> */
|
/** Returns maximum value for each dimension, packed, or null if {@link #size} is <code>0</code> */
|
||||||
public abstract byte[] getMaxPackedValue() throws IOException;
|
public abstract byte[] getMaxPackedValue() throws IOException;
|
||||||
|
|
||||||
/** Returns how many data dimensions are represented in the values */
|
/** Returns how many dimensions are represented in the values */
|
||||||
public abstract int getNumDataDimensions() throws IOException;
|
public abstract int getNumDimensions() throws IOException;
|
||||||
|
|
||||||
/** Returns how many dimensions are used for the index */
|
/** Returns how many dimensions are used for the index */
|
||||||
public abstract int getNumIndexDimensions() throws IOException;
|
public abstract int getNumIndexDimensions() throws IOException;
|
||||||
|
|
|
@ -43,7 +43,7 @@ class PointValuesWriter {
|
||||||
this.bytes = new ByteBlockPool(docWriter.byteBlockAllocator);
|
this.bytes = new ByteBlockPool(docWriter.byteBlockAllocator);
|
||||||
docIDs = new int[16];
|
docIDs = new int[16];
|
||||||
iwBytesUsed.addAndGet(16 * Integer.BYTES);
|
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?
|
// 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");
|
throw new IllegalArgumentException("field=" + fieldInfo.name + ": point value must not be null");
|
||||||
}
|
}
|
||||||
if (value.length != packedBytesLength) {
|
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) {
|
if (docIDs.length == numPoints) {
|
||||||
|
@ -106,7 +106,7 @@ class PointValuesWriter {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getNumDataDimensions() {
|
public int getNumDimensions() {
|
||||||
throw new UnsupportedOperationException();
|
throw new UnsupportedOperationException();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -234,8 +234,8 @@ class PointValuesWriter {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getNumDataDimensions() throws IOException {
|
public int getNumDimensions() throws IOException {
|
||||||
return in.getNumDataDimensions();
|
return in.getNumDimensions();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -342,8 +342,8 @@ class SortingLeafReader extends FilterLeafReader {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getNumDataDimensions() throws IOException {
|
public int getNumDimensions() throws IOException {
|
||||||
return in.getNumDataDimensions();
|
return in.getNumDimensions();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -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);
|
throw new IllegalArgumentException("bytesPerDim must be > 0 and <= " + PointValues.MAX_NUM_BYTES + "; got " + bytesPerDim);
|
||||||
}
|
}
|
||||||
this.bytesPerDim = bytesPerDim;
|
this.bytesPerDim = bytesPerDim;
|
||||||
if (numDims < 1 || numDims > PointValues.MAX_DIMENSIONS) {
|
if (numDims < 1 || numDims > PointValues.MAX_INDEX_DIMENSIONS) {
|
||||||
throw new IllegalArgumentException("numDims must be > 0 and <= " + PointValues.MAX_DIMENSIONS + "; got " + numDims);
|
throw new IllegalArgumentException("numDims must be > 0 and <= " + PointValues.MAX_INDEX_DIMENSIONS + "; got " + numDims);
|
||||||
}
|
}
|
||||||
|
|
||||||
this.numDims = numDims;
|
this.numDims = numDims;
|
||||||
|
|
|
@ -896,7 +896,7 @@ public final class BKDReader extends PointValues implements Accountable {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getNumDataDimensions() {
|
public int getNumDimensions() {
|
||||||
return numDataDims;
|
return numDataDims;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -92,8 +92,11 @@ public class BKDWriter implements Closeable {
|
||||||
/** Default maximum heap to use, before spilling to (slower) disk */
|
/** Default maximum heap to use, before spilling to (slower) disk */
|
||||||
public static final float DEFAULT_MAX_MB_SORT_IN_HEAP = 16.0f;
|
public static final float DEFAULT_MAX_MB_SORT_IN_HEAP = 16.0f;
|
||||||
|
|
||||||
/** Maximum number of dimensions */
|
/** Maximum number of index dimensions (2 * max index dimensions) */
|
||||||
public static final int MAX_DIMS = 8;
|
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. */
|
/** Number of splits before we compute the exact bounding box of an inner node. */
|
||||||
private static final int SPLITS_BEFORE_EXACT_BOUNDS = 4;
|
private static final int SPLITS_BEFORE_EXACT_BOUNDS = 4;
|
||||||
|
@ -185,14 +188,17 @@ public class BKDWriter implements Closeable {
|
||||||
this.maxMBSortInHeap = maxMBSortInHeap;
|
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
|
// 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
|
// remaining 4 bits for another purpose later
|
||||||
if (numDataDims < 1 || numDataDims > MAX_DIMS) {
|
if (numDims < 1 || numDims > MAX_DIMS) {
|
||||||
throw new IllegalArgumentException("numDataDims must be 1 .. " + MAX_DIMS + " (got: " + numDataDims + ")");
|
throw new IllegalArgumentException("numDims must be 1 .. " + MAX_DIMS + " (got: " + numDims + ")");
|
||||||
}
|
}
|
||||||
if (numIndexDims < 1 || numIndexDims > numDataDims) {
|
if (numIndexDims < 1 || numIndexDims > MAX_INDEX_DIMS) {
|
||||||
throw new IllegalArgumentException("numIndexDims must be 1 .. " + numDataDims + " (got: " + numIndexDims + ")");
|
throw new IllegalArgumentException("numIndexDims must be 1 .. " + MAX_INDEX_DIMS + " (got: " + numIndexDims + ")");
|
||||||
|
}
|
||||||
|
if (numIndexDims > numDims) {
|
||||||
|
throw new IllegalArgumentException("numIndexDims cannot exceed numDims (" + numDims + ") (got: " + numIndexDims + ")");
|
||||||
}
|
}
|
||||||
if (maxPointsInLeafNode <= 0) {
|
if (maxPointsInLeafNode <= 0) {
|
||||||
throw new IllegalArgumentException("maxPointsInLeafNode must be > 0; got " + maxPointsInLeafNode);
|
throw new IllegalArgumentException("maxPointsInLeafNode must be > 0; got " + maxPointsInLeafNode);
|
||||||
|
|
|
@ -372,7 +372,7 @@ public class TestLucene60PointsFormat extends BasePointsFormatTestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getNumDataDimensions() throws IOException {
|
public int getNumDimensions() throws IOException {
|
||||||
throw new UnsupportedOperationException();
|
throw new UnsupportedOperationException();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -69,7 +69,7 @@ public class TestFieldType extends LuceneTestCase {
|
||||||
public void testPointsToString() {
|
public void testPointsToString() {
|
||||||
FieldType ft = new FieldType();
|
FieldType ft = new FieldType();
|
||||||
ft.setDimensions(1, Integer.BYTES);
|
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 Class<?>[] parameterTypes = method.getParameterTypes();
|
||||||
final Object[] args = new Object[parameterTypes.length];
|
final Object[] args = new Object[parameterTypes.length];
|
||||||
if (method.equals(setDimensionsMethodA)) {
|
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);
|
args[1] = 1 + random().nextInt(PointValues.MAX_NUM_BYTES);
|
||||||
} else if (method.equals(setDimensionsMethodB)) {
|
} else if (method.equals(setDimensionsMethodB)) {
|
||||||
args[0] = 1 + random().nextInt(PointValues.MAX_DIMENSIONS);
|
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);
|
args[2] = 1 + random().nextInt(PointValues.MAX_NUM_BYTES);
|
||||||
} else {
|
} else {
|
||||||
for (int i = 0; i < args.length; ++i) {
|
for (int i = 0; i < args.length; ++i) {
|
||||||
|
|
|
@ -92,7 +92,7 @@ public class TestIndexableField extends LuceneTestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int pointDataDimensionCount() {
|
public int pointDimensionCount() {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -72,7 +72,7 @@ public class TestPointValues extends LuceneTestCase {
|
||||||
IllegalArgumentException expected = expectThrows(IllegalArgumentException.class, () -> {
|
IllegalArgumentException expected = expectThrows(IllegalArgumentException.class, () -> {
|
||||||
w.addDocument(doc);
|
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();
|
w.close();
|
||||||
dir.close();
|
dir.close();
|
||||||
}
|
}
|
||||||
|
@ -90,7 +90,7 @@ public class TestPointValues extends LuceneTestCase {
|
||||||
IllegalArgumentException expected = expectThrows(IllegalArgumentException.class, () -> {
|
IllegalArgumentException expected = expectThrows(IllegalArgumentException.class, () -> {
|
||||||
w.addDocument(doc2);
|
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();
|
w.close();
|
||||||
dir.close();
|
dir.close();
|
||||||
|
@ -110,7 +110,7 @@ public class TestPointValues extends LuceneTestCase {
|
||||||
IllegalArgumentException expected = expectThrows(IllegalArgumentException.class, () -> {
|
IllegalArgumentException expected = expectThrows(IllegalArgumentException.class, () -> {
|
||||||
w.addDocument(doc2);
|
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();
|
w.close();
|
||||||
dir.close();
|
dir.close();
|
||||||
|
@ -132,7 +132,7 @@ public class TestPointValues extends LuceneTestCase {
|
||||||
IllegalArgumentException expected = expectThrows(IllegalArgumentException.class, () -> {
|
IllegalArgumentException expected = expectThrows(IllegalArgumentException.class, () -> {
|
||||||
w2.addDocument(doc2);
|
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();
|
w2.close();
|
||||||
dir.close();
|
dir.close();
|
||||||
|
@ -155,7 +155,7 @@ public class TestPointValues extends LuceneTestCase {
|
||||||
IllegalArgumentException expected = expectThrows(IllegalArgumentException.class, () -> {
|
IllegalArgumentException expected = expectThrows(IllegalArgumentException.class, () -> {
|
||||||
w2.addIndexes(new Directory[] {dir});
|
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);
|
IOUtils.close(w2, dir, dir2);
|
||||||
}
|
}
|
||||||
|
@ -178,7 +178,7 @@ public class TestPointValues extends LuceneTestCase {
|
||||||
IllegalArgumentException expected = expectThrows(IllegalArgumentException.class, () -> {
|
IllegalArgumentException expected = expectThrows(IllegalArgumentException.class, () -> {
|
||||||
w2.addIndexes(new CodecReader[] {(CodecReader) getOnlyLeafReader(r)});
|
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);
|
IOUtils.close(r, w2, dir, dir2);
|
||||||
}
|
}
|
||||||
|
@ -202,7 +202,7 @@ public class TestPointValues extends LuceneTestCase {
|
||||||
IllegalArgumentException expected = expectThrows(IllegalArgumentException.class, () -> {
|
IllegalArgumentException expected = expectThrows(IllegalArgumentException.class, () -> {
|
||||||
TestUtil.addIndexesSlowly(w2, r);
|
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);
|
IOUtils.close(r, w2, dir, dir2);
|
||||||
}
|
}
|
||||||
|
@ -377,7 +377,7 @@ public class TestPointValues extends LuceneTestCase {
|
||||||
IndexWriterConfig iwc = new IndexWriterConfig(new MockAnalyzer(random()));
|
IndexWriterConfig iwc = new IndexWriterConfig(new MockAnalyzer(random()));
|
||||||
IndexWriter w = new IndexWriter(dir, iwc);
|
IndexWriter w = new IndexWriter(dir, iwc);
|
||||||
Document doc = new Document();
|
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++) {
|
for(int i=0;i<values.length;i++) {
|
||||||
values[i] = new byte[4];
|
values[i] = new byte[4];
|
||||||
}
|
}
|
||||||
|
|
|
@ -608,7 +608,7 @@ public class TestPointQueries extends LuceneTestCase {
|
||||||
private void doTestRandomBinary(int count) throws Exception {
|
private void doTestRandomBinary(int count) throws Exception {
|
||||||
int numValues = TestUtil.nextInt(random(), count, count*2);
|
int numValues = TestUtil.nextInt(random(), count, count*2);
|
||||||
int numBytesPerDim = TestUtil.nextInt(random(), 2, PointValues.MAX_NUM_BYTES);
|
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);
|
int sameValuePct = random().nextInt(100);
|
||||||
if (VERBOSE) {
|
if (VERBOSE) {
|
||||||
|
|
|
@ -327,7 +327,7 @@ public class TestDocIdSetBuilder extends LuceneTestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getNumDataDimensions() throws IOException {
|
public int getNumDimensions() throws IOException {
|
||||||
throw new UnsupportedOperationException();
|
throw new UnsupportedOperationException();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -385,8 +385,8 @@ public class TestBKD extends LuceneTestCase {
|
||||||
public void testWithExceptions() throws Exception {
|
public void testWithExceptions() throws Exception {
|
||||||
int numDocs = atLeast(10000);
|
int numDocs = atLeast(10000);
|
||||||
int numBytesPerDim = TestUtil.nextInt(random(), 2, 30);
|
int numBytesPerDim = TestUtil.nextInt(random(), 2, 30);
|
||||||
int numDataDims = TestUtil.nextInt(random(), 1, 5);
|
int numDataDims = TestUtil.nextInt(random(), 1, PointValues.MAX_DIMENSIONS);
|
||||||
int numIndexDims = TestUtil.nextInt(random(), 1, numDataDims);
|
int numIndexDims = Math.min(TestUtil.nextInt(random(), 1, numDataDims), PointValues.MAX_INDEX_DIMENSIONS);
|
||||||
|
|
||||||
byte[][][] docValues = new byte[numDocs][][];
|
byte[][][] docValues = new byte[numDocs][][];
|
||||||
|
|
||||||
|
@ -455,8 +455,8 @@ public class TestBKD extends LuceneTestCase {
|
||||||
int numDocs = TestUtil.nextInt(random(), count, count*2);
|
int numDocs = TestUtil.nextInt(random(), count, count*2);
|
||||||
int numBytesPerDim = TestUtil.nextInt(random(), 2, 30);
|
int numBytesPerDim = TestUtil.nextInt(random(), 2, 30);
|
||||||
|
|
||||||
int numDataDims = TestUtil.nextInt(random(), 1, 5);
|
int numDataDims = TestUtil.nextInt(random(), 1, PointValues.MAX_DIMENSIONS);
|
||||||
int numIndexDims = TestUtil.nextInt(random(), 1, numDataDims);
|
int numIndexDims = Math.min(TestUtil.nextInt(random(), 1, numDataDims), PointValues.MAX_INDEX_DIMENSIONS);
|
||||||
|
|
||||||
byte[][][] docValues = new byte[numDocs][][];
|
byte[][][] docValues = new byte[numDocs][][];
|
||||||
|
|
||||||
|
@ -474,8 +474,8 @@ public class TestBKD extends LuceneTestCase {
|
||||||
|
|
||||||
public void testAllEqual() throws Exception {
|
public void testAllEqual() throws Exception {
|
||||||
int numBytesPerDim = TestUtil.nextInt(random(), 2, 30);
|
int numBytesPerDim = TestUtil.nextInt(random(), 2, 30);
|
||||||
int numDataDims = TestUtil.nextInt(random(), 1, 5);
|
int numDataDims = TestUtil.nextInt(random(), 1, PointValues.MAX_DIMENSIONS);
|
||||||
int numIndexDims = TestUtil.nextInt(random(), 1, numDataDims);
|
int numIndexDims = Math.min(TestUtil.nextInt(random(), 1, numDataDims), PointValues.MAX_INDEX_DIMENSIONS);
|
||||||
|
|
||||||
int numDocs = atLeast(1000);
|
int numDocs = atLeast(1000);
|
||||||
byte[][][] docValues = new byte[numDocs][][];
|
byte[][][] docValues = new byte[numDocs][][];
|
||||||
|
@ -498,8 +498,8 @@ public class TestBKD extends LuceneTestCase {
|
||||||
|
|
||||||
public void testIndexDimEqualDataDimDifferent() throws Exception {
|
public void testIndexDimEqualDataDimDifferent() throws Exception {
|
||||||
int numBytesPerDim = TestUtil.nextInt(random(), 2, 30);
|
int numBytesPerDim = TestUtil.nextInt(random(), 2, 30);
|
||||||
int numDataDims = TestUtil.nextInt(random(), 2, 5);
|
int numDataDims = TestUtil.nextInt(random(), 2, PointValues.MAX_DIMENSIONS);
|
||||||
int numIndexDims = TestUtil.nextInt(random(), 1, numDataDims - 1);
|
int numIndexDims = Math.min(TestUtil.nextInt(random(), 1, numDataDims - 1), PointValues.MAX_INDEX_DIMENSIONS);
|
||||||
|
|
||||||
int numDocs = atLeast(1000);
|
int numDocs = atLeast(1000);
|
||||||
byte[][][] docValues = new byte[numDocs][][];
|
byte[][][] docValues = new byte[numDocs][][];
|
||||||
|
@ -527,8 +527,8 @@ public class TestBKD extends LuceneTestCase {
|
||||||
|
|
||||||
public void testOneDimEqual() throws Exception {
|
public void testOneDimEqual() throws Exception {
|
||||||
int numBytesPerDim = TestUtil.nextInt(random(), 2, 30);
|
int numBytesPerDim = TestUtil.nextInt(random(), 2, 30);
|
||||||
int numDataDims = TestUtil.nextInt(random(), 1, 5);
|
int numDataDims = TestUtil.nextInt(random(), 1, PointValues.MAX_DIMENSIONS);
|
||||||
int numIndexDims = TestUtil.nextInt(random(), 1, numDataDims);
|
int numIndexDims = Math.min(TestUtil.nextInt(random(), 1, numDataDims), PointValues.MAX_INDEX_DIMENSIONS);
|
||||||
|
|
||||||
int numDocs = atLeast(1000);
|
int numDocs = atLeast(1000);
|
||||||
int theEqualDim = random().nextInt(numDataDims);
|
int theEqualDim = random().nextInt(numDataDims);
|
||||||
|
@ -554,8 +554,8 @@ public class TestBKD extends LuceneTestCase {
|
||||||
// by looking at how many times each dim has been split
|
// by looking at how many times each dim has been split
|
||||||
public void testOneDimLowCard() throws Exception {
|
public void testOneDimLowCard() throws Exception {
|
||||||
int numBytesPerDim = TestUtil.nextInt(random(), 2, 30);
|
int numBytesPerDim = TestUtil.nextInt(random(), 2, 30);
|
||||||
int numDataDims = TestUtil.nextInt(random(), 2, 5);
|
int numDataDims = TestUtil.nextInt(random(), 2, PointValues.MAX_DIMENSIONS);
|
||||||
int numIndexDims = TestUtil.nextInt(random(), 2, numDataDims);
|
int numIndexDims = Math.min(TestUtil.nextInt(random(), 2, numDataDims), PointValues.MAX_INDEX_DIMENSIONS);
|
||||||
|
|
||||||
int numDocs = atLeast(10000);
|
int numDocs = atLeast(10000);
|
||||||
int theLowCardDim = random().nextInt(numDataDims);
|
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 255
|
// this should trigger run-length compression with lengths that are greater than 255
|
||||||
public void testOneDimTwoValues() throws Exception {
|
public void testOneDimTwoValues() throws Exception {
|
||||||
int numBytesPerDim = TestUtil.nextInt(random(), 2, 30);
|
int numBytesPerDim = TestUtil.nextInt(random(), 2, 30);
|
||||||
int numDataDims = TestUtil.nextInt(random(), 1, 5);
|
int numDataDims = TestUtil.nextInt(random(), 1, PointValues.MAX_DIMENSIONS);
|
||||||
int numIndexDims = TestUtil.nextInt(random(), 1, numDataDims);
|
int numIndexDims = Math.min(TestUtil.nextInt(random(), 1, numDataDims), PointValues.MAX_INDEX_DIMENSIONS);
|
||||||
|
|
||||||
int numDocs = atLeast(1000);
|
int numDocs = atLeast(1000);
|
||||||
int theDim = random().nextInt(numDataDims);
|
int theDim = random().nextInt(numDataDims);
|
||||||
|
@ -621,8 +621,8 @@ public class TestBKD extends LuceneTestCase {
|
||||||
// this should trigger low cardinality leaves
|
// this should trigger low cardinality leaves
|
||||||
public void testRandomFewDifferentValues() throws Exception {
|
public void testRandomFewDifferentValues() throws Exception {
|
||||||
int numBytesPerDim = TestUtil.nextInt(random(), 2, 30);
|
int numBytesPerDim = TestUtil.nextInt(random(), 2, 30);
|
||||||
int numIndexDims = TestUtil.nextInt(random(), 1, 8);
|
int numDataDims = TestUtil.nextInt(random(), 1, PointValues.MAX_DIMENSIONS);
|
||||||
int numDataDims = TestUtil.nextInt(random(), numIndexDims, 8);
|
int numIndexDims = Math.min(TestUtil.nextInt(random(), 1, numDataDims), PointValues.MAX_INDEX_DIMENSIONS);
|
||||||
|
|
||||||
int numDocs = atLeast(10000);
|
int numDocs = atLeast(10000);
|
||||||
int cardinality = TestUtil.nextInt(random(), 2, 100);
|
int cardinality = TestUtil.nextInt(random(), 2, 100);
|
||||||
|
@ -643,8 +643,8 @@ public class TestBKD extends LuceneTestCase {
|
||||||
|
|
||||||
public void testMultiValued() throws Exception {
|
public void testMultiValued() throws Exception {
|
||||||
int numBytesPerDim = TestUtil.nextInt(random(), 2, 30);
|
int numBytesPerDim = TestUtil.nextInt(random(), 2, 30);
|
||||||
int numDataDims = TestUtil.nextInt(random(), 1, 5);
|
int numDataDims = TestUtil.nextInt(random(), 1, PointValues.MAX_DIMENSIONS);
|
||||||
int numIndexDims = TestUtil.nextInt(random(), 1, numDataDims);
|
int numIndexDims = Math.min(TestUtil.nextInt(random(), 1, numDataDims), PointValues.MAX_INDEX_DIMENSIONS);
|
||||||
|
|
||||||
int numDocs = atLeast(1000);
|
int numDocs = atLeast(1000);
|
||||||
List<byte[][]> docValues = new ArrayList<>();
|
List<byte[][]> docValues = new ArrayList<>();
|
||||||
|
@ -1222,7 +1222,7 @@ public class TestBKD extends LuceneTestCase {
|
||||||
// values as a LongPoint:
|
// values as a LongPoint:
|
||||||
public void testWastedLeadingBytes() throws Exception {
|
public void testWastedLeadingBytes() throws Exception {
|
||||||
Random random = random();
|
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 numIndexDims = TestUtil.nextInt(random, 1, numDims);
|
||||||
int bytesPerDim = PointValues.MAX_NUM_BYTES;
|
int bytesPerDim = PointValues.MAX_NUM_BYTES;
|
||||||
int bytesUsed = TestUtil.nextInt(random, 1, 3);
|
int bytesUsed = TestUtil.nextInt(random, 1, 3);
|
||||||
|
@ -1403,7 +1403,7 @@ public class TestBKD extends LuceneTestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getNumDataDimensions() {
|
public int getNumDimensions() {
|
||||||
throw new UnsupportedOperationException();
|
throw new UnsupportedOperationException();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1538,7 +1538,7 @@ public class TestBKD extends LuceneTestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getNumDataDimensions() {
|
public int getNumDimensions() {
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -270,7 +270,7 @@ public class TestMutablePointsReaderUtils extends LuceneTestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getNumDataDimensions() throws IOException {
|
public int getNumDimensions() throws IOException {
|
||||||
throw new UnsupportedOperationException();
|
throw new UnsupportedOperationException();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -158,8 +158,8 @@ abstract class PointInSetIncludingScoreQuery extends Query implements Accountabl
|
||||||
if (fieldInfo == null) {
|
if (fieldInfo == null) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
if (fieldInfo.getPointDataDimensionCount() != 1) {
|
if (fieldInfo.getPointDimensionCount() != 1) {
|
||||||
throw new IllegalArgumentException("field=\"" + field + "\" was indexed with numDims=" + fieldInfo.getPointDataDimensionCount() + " but this query has numDims=1");
|
throw new IllegalArgumentException("field=\"" + field + "\" was indexed with numDims=" + fieldInfo.getPointDimensionCount() + " but this query has numDims=1");
|
||||||
}
|
}
|
||||||
if (fieldInfo.getPointNumBytes() != bytesPerDim) {
|
if (fieldInfo.getPointNumBytes() != bytesPerDim) {
|
||||||
throw new IllegalArgumentException("field=\"" + field + "\" was indexed with bytesPerDim=" + fieldInfo.getPointNumBytes() + " but this query has bytesPerDim=" + bytesPerDim);
|
throw new IllegalArgumentException("field=\"" + field + "\" was indexed with bytesPerDim=" + fieldInfo.getPointNumBytes() + " but this query has bytesPerDim=" + bytesPerDim);
|
||||||
|
|
|
@ -246,7 +246,7 @@ public final class IndexOptionsDialogFactory implements DialogOpener.DialogFacto
|
||||||
storeTVOffCB.setSelected(fieldType.storeTermVectorOffsets());
|
storeTVOffCB.setSelected(fieldType.storeTermVectorOffsets());
|
||||||
storeTVPayCB.setSelected(fieldType.storeTermVectorPayloads());
|
storeTVPayCB.setSelected(fieldType.storeTermVectorPayloads());
|
||||||
dvTypeCombo.setSelectedItem(fieldType.docValuesType().name());
|
dvTypeCombo.setSelectedItem(fieldType.docValuesType().name());
|
||||||
dimCountTF.setText(String.valueOf(fieldType.pointDataDimensionCount()));
|
dimCountTF.setText(String.valueOf(fieldType.pointDimensionCount()));
|
||||||
dimNumBytesTF.setText(String.valueOf(fieldType.pointNumBytes()));
|
dimNumBytesTF.setText(String.valueOf(fieldType.pointNumBytes()));
|
||||||
|
|
||||||
if (nf.getType().equals(org.apache.lucene.document.TextField.class) ||
|
if (nf.getType().equals(org.apache.lucene.document.TextField.class) ||
|
||||||
|
|
|
@ -85,7 +85,7 @@ public final class DocumentField {
|
||||||
|
|
||||||
dfield.dvType = finfo.getDocValuesType();
|
dfield.dvType = finfo.getDocValuesType();
|
||||||
|
|
||||||
dfield.pointDimensionCount = finfo.getPointDataDimensionCount();
|
dfield.pointDimensionCount = finfo.getPointDimensionCount();
|
||||||
dfield.pointNumBytes = finfo.getPointNumBytes();
|
dfield.pointNumBytes = finfo.getPointNumBytes();
|
||||||
|
|
||||||
if (field != null) {
|
if (field != null) {
|
||||||
|
|
|
@ -123,7 +123,7 @@ public final class SearchImpl extends LukeModel implements Search {
|
||||||
public Collection<String> getRangeSearchableFieldNames() {
|
public Collection<String> getRangeSearchableFieldNames() {
|
||||||
return IndexUtils.getFieldNames(reader).stream()
|
return IndexUtils.getFieldNames(reader).stream()
|
||||||
.map(f -> IndexUtils.getFieldInfo(reader, f))
|
.map(f -> IndexUtils.getFieldInfo(reader, f))
|
||||||
.filter(info -> info.getPointDataDimensionCount() > 0)
|
.filter(info -> info.getPointDimensionCount() > 0)
|
||||||
.map(info -> info.name)
|
.map(info -> info.name)
|
||||||
.collect(Collectors.toSet());
|
.collect(Collectors.toSet());
|
||||||
}
|
}
|
||||||
|
|
|
@ -410,7 +410,7 @@ public class MemoryIndex {
|
||||||
storeDocValues(info, docValuesType, docValuesValue);
|
storeDocValues(info, docValuesType, docValuesValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (field.fieldType().pointDataDimensionCount() > 0) {
|
if (field.fieldType().pointDimensionCount() > 0) {
|
||||||
storePointValues(info, field.binaryValue());
|
storePointValues(info, field.binaryValue());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -486,9 +486,9 @@ public class MemoryIndex {
|
||||||
if (info == null) {
|
if (info == null) {
|
||||||
fields.put(fieldName, info = new Info(createFieldInfo(fieldName, fields.size(), fieldType), byteBlockPool));
|
fields.put(fieldName, info = new Info(createFieldInfo(fieldName, fields.size(), fieldType), byteBlockPool));
|
||||||
}
|
}
|
||||||
if (fieldType.pointDataDimensionCount() != info.fieldInfo.getPointDataDimensionCount()) {
|
if (fieldType.pointDimensionCount() != info.fieldInfo.getPointDimensionCount()) {
|
||||||
if (fieldType.pointDataDimensionCount() > 0)
|
if (fieldType.pointDimensionCount() > 0)
|
||||||
info.fieldInfo.setPointDimensions(fieldType.pointDataDimensionCount(), fieldType.pointIndexDimensionCount(), fieldType.pointNumBytes());
|
info.fieldInfo.setPointDimensions(fieldType.pointDimensionCount(), fieldType.pointIndexDimensionCount(), fieldType.pointNumBytes());
|
||||||
}
|
}
|
||||||
if (fieldType.docValuesType() != info.fieldInfo.getDocValuesType()) {
|
if (fieldType.docValuesType() != info.fieldInfo.getDocValuesType()) {
|
||||||
if (fieldType.docValuesType() != DocValuesType.NONE)
|
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;
|
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,
|
return new FieldInfo(fieldName, ord, fieldType.storeTermVectors(), fieldType.omitNorms(), storePayloads,
|
||||||
indexOptions, fieldType.docValuesType(), -1, Collections.emptyMap(),
|
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) {
|
private void storePointValues(Info info, BytesRef pointValue) {
|
||||||
|
@ -520,7 +520,7 @@ public class MemoryIndex {
|
||||||
info.fieldInfo = new FieldInfo(
|
info.fieldInfo = new FieldInfo(
|
||||||
info.fieldInfo.name, info.fieldInfo.number, info.fieldInfo.hasVectors(), info.fieldInfo.hasPayloads(),
|
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.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()
|
info.fieldInfo.isSoftDeletesField()
|
||||||
);
|
);
|
||||||
} else if (existingDocValuesType != docValuesType) {
|
} else if (existingDocValuesType != docValuesType) {
|
||||||
|
@ -871,7 +871,7 @@ public class MemoryIndex {
|
||||||
if (pointValues != null) {
|
if (pointValues != null) {
|
||||||
assert pointValues[0].bytes.length == pointValues[0].length : "BytesRef should wrap a precise byte[], BytesRef.deepCopyOf() should take care of this";
|
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();
|
final int numBytesPerDimension = fieldInfo.getPointNumBytes();
|
||||||
if (numDimensions == 1) {
|
if (numDimensions == 1) {
|
||||||
// PointInSetQuery.MergePointVisitor expects values to be visited in increasing order,
|
// PointInSetQuery.MergePointVisitor expects values to be visited in increasing order,
|
||||||
|
@ -1580,13 +1580,13 @@ public class MemoryIndex {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getNumDataDimensions() throws IOException {
|
public int getNumDimensions() throws IOException {
|
||||||
return info.fieldInfo.getPointDataDimensionCount();
|
return info.fieldInfo.getPointDimensionCount();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getNumIndexDimensions() throws IOException {
|
public int getNumIndexDimensions() throws IOException {
|
||||||
return info.fieldInfo.getPointDataDimensionCount();
|
return info.fieldInfo.getPointDimensionCount();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -62,8 +62,8 @@ public class BigIntegerPoint extends Field {
|
||||||
|
|
||||||
/** Change the values of this field */
|
/** Change the values of this field */
|
||||||
public void setBigIntegerValues(BigInteger... point) {
|
public void setBigIntegerValues(BigInteger... point) {
|
||||||
if (type.pointDataDimensionCount() != point.length) {
|
if (type.pointDimensionCount() != point.length) {
|
||||||
throw new IllegalArgumentException("this field (name=" + name + ") uses " + type.pointDataDimensionCount() + " dimensions; cannot change to (incoming) " + point.length + " dimensions");
|
throw new IllegalArgumentException("this field (name=" + name + ") uses " + type.pointDimensionCount() + " dimensions; cannot change to (incoming) " + point.length + " dimensions");
|
||||||
}
|
}
|
||||||
fieldsData = pack(point);
|
fieldsData = pack(point);
|
||||||
}
|
}
|
||||||
|
@ -75,8 +75,8 @@ public class BigIntegerPoint extends Field {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Number numericValue() {
|
public Number numericValue() {
|
||||||
if (type.pointDataDimensionCount() != 1) {
|
if (type.pointDimensionCount() != 1) {
|
||||||
throw new IllegalStateException("this field (name=" + name + ") uses " + type.pointDataDimensionCount() + " dimensions; cannot convert to a single numeric value");
|
throw new IllegalStateException("this field (name=" + name + ") uses " + type.pointDimensionCount() + " dimensions; cannot convert to a single numeric value");
|
||||||
}
|
}
|
||||||
BytesRef bytes = (BytesRef) fieldsData;
|
BytesRef bytes = (BytesRef) fieldsData;
|
||||||
assert bytes.length == BYTES;
|
assert bytes.length == BYTES;
|
||||||
|
@ -119,7 +119,7 @@ public class BigIntegerPoint extends Field {
|
||||||
result.append(':');
|
result.append(':');
|
||||||
|
|
||||||
BytesRef bytes = (BytesRef) fieldsData;
|
BytesRef bytes = (BytesRef) fieldsData;
|
||||||
for (int dim = 0; dim < type.pointDataDimensionCount(); dim++) {
|
for (int dim = 0; dim < type.pointDimensionCount(); dim++) {
|
||||||
if (dim > 0) {
|
if (dim > 0) {
|
||||||
result.append(',');
|
result.append(',');
|
||||||
}
|
}
|
||||||
|
|
|
@ -213,8 +213,8 @@ public final class HalfFloatPoint extends Field {
|
||||||
|
|
||||||
/** Change the values of this field */
|
/** Change the values of this field */
|
||||||
public void setFloatValues(float... point) {
|
public void setFloatValues(float... point) {
|
||||||
if (type.pointDataDimensionCount() != point.length) {
|
if (type.pointDimensionCount() != point.length) {
|
||||||
throw new IllegalArgumentException("this field (name=" + name + ") uses " + type.pointDataDimensionCount() + " dimensions; cannot change to (incoming) " + point.length + " dimensions");
|
throw new IllegalArgumentException("this field (name=" + name + ") uses " + type.pointDimensionCount() + " dimensions; cannot change to (incoming) " + point.length + " dimensions");
|
||||||
}
|
}
|
||||||
fieldsData = pack(point);
|
fieldsData = pack(point);
|
||||||
}
|
}
|
||||||
|
@ -226,8 +226,8 @@ public final class HalfFloatPoint extends Field {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Number numericValue() {
|
public Number numericValue() {
|
||||||
if (type.pointDataDimensionCount() != 1) {
|
if (type.pointDimensionCount() != 1) {
|
||||||
throw new IllegalStateException("this field (name=" + name + ") uses " + type.pointDataDimensionCount() + " dimensions; cannot convert to a single numeric value");
|
throw new IllegalStateException("this field (name=" + name + ") uses " + type.pointDimensionCount() + " dimensions; cannot convert to a single numeric value");
|
||||||
}
|
}
|
||||||
BytesRef bytes = (BytesRef) fieldsData;
|
BytesRef bytes = (BytesRef) fieldsData;
|
||||||
assert bytes.length == BYTES;
|
assert bytes.length == BYTES;
|
||||||
|
@ -270,7 +270,7 @@ public final class HalfFloatPoint extends Field {
|
||||||
result.append(':');
|
result.append(':');
|
||||||
|
|
||||||
BytesRef bytes = (BytesRef) fieldsData;
|
BytesRef bytes = (BytesRef) fieldsData;
|
||||||
for (int dim = 0; dim < type.pointDataDimensionCount(); dim++) {
|
for (int dim = 0; dim < type.pointDimensionCount(); dim++) {
|
||||||
if (dim > 0) {
|
if (dim > 0) {
|
||||||
result.append(',');
|
result.append(',');
|
||||||
}
|
}
|
||||||
|
|
|
@ -144,7 +144,7 @@ public class TestFloatPointNearestNeighbor extends LuceneTestCase {
|
||||||
iwc.setMergeScheduler(new SerialMergeScheduler());
|
iwc.setMergeScheduler(new SerialMergeScheduler());
|
||||||
RandomIndexWriter w = new RandomIndexWriter(random(), dir, iwc);
|
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];
|
float[][] values = new float[numPoints][dims];
|
||||||
for (int id = 0 ; id < numPoints ; ++id) {
|
for (int id = 0 ; id < numPoints ; ++id) {
|
||||||
for (int dim = 0 ; dim < dims ; ++dim) {
|
for (int dim = 0 ; dim < dims ; ++dim) {
|
||||||
|
|
|
@ -148,7 +148,7 @@ public class BBoxStrategy extends SpatialStrategy {
|
||||||
if ((this.hasDocVals = fieldType.docValuesType() != DocValuesType.NONE)) {
|
if ((this.hasDocVals = fieldType.docValuesType() != DocValuesType.NONE)) {
|
||||||
numQuads++;
|
numQuads++;
|
||||||
}
|
}
|
||||||
if ((this.hasPointVals = fieldType.pointDataDimensionCount() > 0)) {
|
if ((this.hasPointVals = fieldType.pointDimensionCount() > 0)) {
|
||||||
numQuads++;
|
numQuads++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -140,7 +140,7 @@ public class PointVectorStrategy extends SpatialStrategy {
|
||||||
if ((this.hasDocVals = fieldType.docValuesType() != DocValuesType.NONE)) {
|
if ((this.hasDocVals = fieldType.docValuesType() != DocValuesType.NONE)) {
|
||||||
numPairs++;
|
numPairs++;
|
||||||
}
|
}
|
||||||
if ((this.hasPointVals = fieldType.pointDataDimensionCount() > 0)) {
|
if ((this.hasPointVals = fieldType.pointDimensionCount() > 0)) {
|
||||||
numPairs++;
|
numPairs++;
|
||||||
}
|
}
|
||||||
this.fieldsLen = numPairs * 2;
|
this.fieldsLen = numPairs * 2;
|
||||||
|
|
|
@ -138,8 +138,8 @@ public final class AssertingPointsFormat extends PointsFormat {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void writeField(FieldInfo fieldInfo, PointsReader values) throws IOException {
|
public void writeField(FieldInfo fieldInfo, PointsReader values) throws IOException {
|
||||||
if (fieldInfo.getPointDataDimensionCount() == 0) {
|
if (fieldInfo.getPointDimensionCount() == 0) {
|
||||||
throw new IllegalArgumentException("writing field=\"" + fieldInfo.name + "\" but pointDataDimensionalCount is 0");
|
throw new IllegalArgumentException("writing field=\"" + fieldInfo.name + "\" but pointDimensionalCount is 0");
|
||||||
}
|
}
|
||||||
in.writeField(fieldInfo, values);
|
in.writeField(fieldInfo, values);
|
||||||
}
|
}
|
||||||
|
|
|
@ -155,11 +155,11 @@ class CrankyPointsFormat extends PointsFormat {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getNumDataDimensions() throws IOException {
|
public int getNumDimensions() throws IOException {
|
||||||
if (random.nextInt(100) == 0) {
|
if (random.nextInt(100) == 0) {
|
||||||
throw new IOException("Fake IOException");
|
throw new IOException("Fake IOException");
|
||||||
}
|
}
|
||||||
return delegate.getNumDataDimensions();
|
return delegate.getNumDimensions();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -1049,7 +1049,7 @@ public class AssertingLeafReader extends FilterLeafReader {
|
||||||
@Override
|
@Override
|
||||||
public void intersect(IntersectVisitor visitor) throws IOException {
|
public void intersect(IntersectVisitor visitor) throws IOException {
|
||||||
assertThread("Points", creationThread);
|
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
|
@Override
|
||||||
|
@ -1073,9 +1073,9 @@ public class AssertingLeafReader extends FilterLeafReader {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getNumDataDimensions() throws IOException {
|
public int getNumDimensions() throws IOException {
|
||||||
assertThread("Points", creationThread);
|
assertThread("Points", creationThread);
|
||||||
return in.getNumDataDimensions();
|
return in.getNumDimensions();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -347,7 +347,7 @@ abstract class BaseIndexFileFormatTestCase extends LuceneTestCase {
|
||||||
FieldInfo proto = oneDocReader.getFieldInfos().fieldInfo("field");
|
FieldInfo proto = oneDocReader.getFieldInfos().fieldInfo("field");
|
||||||
FieldInfo field = new FieldInfo(proto.name, proto.number, proto.hasVectors(), proto.omitsNorms(), proto.hasPayloads(),
|
FieldInfo field = new FieldInfo(proto.name, proto.number, proto.hasVectors(), proto.omitsNorms(), proto.hasPayloads(),
|
||||||
proto.getIndexOptions(), proto.getDocValuesType(), proto.getDocValuesGen(), new HashMap<>(),
|
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 } );
|
FieldInfos fieldInfos = new FieldInfos(new FieldInfo[] { field } );
|
||||||
|
|
||||||
|
|
|
@ -212,6 +212,7 @@ public abstract class BasePointsFormatTestCase extends BaseIndexFileFormatTestCa
|
||||||
int numDocs = atLeast(1000);
|
int numDocs = atLeast(1000);
|
||||||
int numBytesPerDim = TestUtil.nextInt(random(), 2, PointValues.MAX_NUM_BYTES);
|
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_DIMENSIONS);
|
||||||
|
int numIndexDims = TestUtil.nextInt(random(), 1, Math.min(numDims, PointValues.MAX_INDEX_DIMENSIONS));
|
||||||
|
|
||||||
byte[][][] docValues = new byte[numDocs][][];
|
byte[][][] docValues = new byte[numDocs][][];
|
||||||
|
|
||||||
|
@ -231,7 +232,7 @@ public abstract class BasePointsFormatTestCase extends BaseIndexFileFormatTestCa
|
||||||
try {
|
try {
|
||||||
dir.setRandomIOExceptionRate(0.05);
|
dir.setRandomIOExceptionRate(0.05);
|
||||||
dir.setRandomIOExceptionRateOnOpen(0.05);
|
dir.setRandomIOExceptionRateOnOpen(0.05);
|
||||||
verify(dir, docValues, null, numDims, numBytesPerDim, true);
|
verify(dir, docValues, null, numDims, numIndexDims, numBytesPerDim, true);
|
||||||
} catch (IllegalStateException ise) {
|
} catch (IllegalStateException ise) {
|
||||||
done = handlePossiblyFakeException(ise);
|
done = handlePossiblyFakeException(ise);
|
||||||
} catch (AssertionError ae) {
|
} catch (AssertionError ae) {
|
||||||
|
@ -270,6 +271,7 @@ public abstract class BasePointsFormatTestCase extends BaseIndexFileFormatTestCa
|
||||||
public void testMultiValued() throws Exception {
|
public void testMultiValued() throws Exception {
|
||||||
int numBytesPerDim = TestUtil.nextInt(random(), 2, PointValues.MAX_NUM_BYTES);
|
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_DIMENSIONS);
|
||||||
|
int numIndexDims = TestUtil.nextInt(random(), 1, Math.min(PointValues.MAX_INDEX_DIMENSIONS, numDims));
|
||||||
|
|
||||||
int numDocs = TEST_NIGHTLY ? atLeast(1000) : atLeast(100);
|
int numDocs = TEST_NIGHTLY ? atLeast(1000) : atLeast(100);
|
||||||
List<byte[][]> docValues = new ArrayList<>();
|
List<byte[][]> docValues = new ArrayList<>();
|
||||||
|
@ -294,12 +296,12 @@ public abstract class BasePointsFormatTestCase extends BaseIndexFileFormatTestCa
|
||||||
docIDsArray[i] = docIDs.get(i);
|
docIDsArray[i] = docIDs.get(i);
|
||||||
}
|
}
|
||||||
|
|
||||||
verify(docValuesArray, docIDsArray, numDims, numBytesPerDim);
|
verify(docValuesArray, docIDsArray, numDims, numIndexDims, numBytesPerDim);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testAllEqual() throws Exception {
|
public void testAllEqual() throws Exception {
|
||||||
int numBytesPerDim = TestUtil.nextInt(random(), 2, PointValues.MAX_NUM_BYTES);
|
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 numDocs = atLeast(1000);
|
||||||
byte[][][] docValues = new byte[numDocs][][];
|
byte[][][] docValues = new byte[numDocs][][];
|
||||||
|
@ -322,7 +324,7 @@ public abstract class BasePointsFormatTestCase extends BaseIndexFileFormatTestCa
|
||||||
|
|
||||||
public void testOneDimEqual() throws Exception {
|
public void testOneDimEqual() throws Exception {
|
||||||
int numBytesPerDim = TestUtil.nextInt(random(), 2, PointValues.MAX_NUM_BYTES);
|
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 numDocs = atLeast(1000);
|
||||||
int theEqualDim = random().nextInt(numDims);
|
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 255
|
// this should trigger run-length compression with lengths that are greater than 255
|
||||||
public void testOneDimTwoValues() throws Exception {
|
public void testOneDimTwoValues() throws Exception {
|
||||||
int numBytesPerDim = TestUtil.nextInt(random(), 2, PointValues.MAX_NUM_BYTES);
|
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 numDocs = atLeast(1000);
|
||||||
int theDim = random().nextInt(numDims);
|
int theDim = random().nextInt(numDims);
|
||||||
|
@ -378,7 +380,7 @@ public abstract class BasePointsFormatTestCase extends BaseIndexFileFormatTestCa
|
||||||
int numDocs = atLeast(200);
|
int numDocs = atLeast(200);
|
||||||
try (Directory dir = getDirectory(numDocs)) {
|
try (Directory dir = getDirectory(numDocs)) {
|
||||||
int numBytesPerDim = TestUtil.nextInt(random(), 2, PointValues.MAX_NUM_BYTES);
|
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()));
|
IndexWriterConfig iwc = newIndexWriterConfig(new MockAnalyzer(random()));
|
||||||
// We rely on docIDs not changing:
|
// We rely on docIDs not changing:
|
||||||
iwc.setMergePolicy(newLogMergePolicy());
|
iwc.setMergePolicy(newLogMergePolicy());
|
||||||
|
@ -520,7 +522,7 @@ public abstract class BasePointsFormatTestCase extends BaseIndexFileFormatTestCa
|
||||||
private void doTestRandomBinary(int count) throws Exception {
|
private void doTestRandomBinary(int count) throws Exception {
|
||||||
int numDocs = TestUtil.nextInt(random(), count, count*2);
|
int numDocs = TestUtil.nextInt(random(), count, count*2);
|
||||||
int numBytesPerDim = TestUtil.nextInt(random(), 2, PointValues.MAX_NUM_BYTES);
|
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);
|
int numIndexDims = TestUtil.nextInt(random(), 1, numDataDims);
|
||||||
|
|
||||||
byte[][][] docValues = new byte[numDocs][][];
|
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) {
|
private byte[] flattenBinaryPoint(byte[][] value, int numDataDims, int numBytesPerDim) {
|
||||||
byte[] result = new byte[value.length * numBytesPerDim];
|
byte[] result = new byte[value.length * numBytesPerDim];
|
||||||
for (int d = 0; d < numDataDims; ++d) {
|
for (int d = 0; d < numDataDims; ++d) {
|
||||||
|
@ -571,10 +569,10 @@ public abstract class BasePointsFormatTestCase extends BaseIndexFileFormatTestCa
|
||||||
}
|
}
|
||||||
|
|
||||||
/** test selective indexing */
|
/** 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;
|
int numValues = docValues.length;
|
||||||
if (VERBOSE) {
|
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:
|
// RandomIndexWriter is too slow:
|
||||||
|
@ -597,10 +595,10 @@ public abstract class BasePointsFormatTestCase extends BaseIndexFileFormatTestCa
|
||||||
DirectoryReader r = null;
|
DirectoryReader r = null;
|
||||||
|
|
||||||
// Compute actual min/max values:
|
// Compute actual min/max values:
|
||||||
byte[][] expectedMinValues = new byte[numDataDims][];
|
byte[][] expectedMinValues = new byte[numDims][];
|
||||||
byte[][] expectedMaxValues = new byte[numDataDims][];
|
byte[][] expectedMaxValues = new byte[numDims][];
|
||||||
for(int ord=0;ord<docValues.length;ord++) {
|
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) {
|
if (ord == 0) {
|
||||||
expectedMinValues[dim] = new byte[numBytesPerDim];
|
expectedMinValues[dim] = new byte[numBytesPerDim];
|
||||||
System.arraycopy(docValues[ord][dim], 0, expectedMinValues[dim], 0, numBytesPerDim);
|
System.arraycopy(docValues[ord][dim], 0, expectedMinValues[dim], 0, numBytesPerDim);
|
||||||
|
@ -649,7 +647,7 @@ public abstract class BasePointsFormatTestCase extends BaseIndexFileFormatTestCa
|
||||||
try {
|
try {
|
||||||
|
|
||||||
FieldType fieldType = new FieldType();
|
FieldType fieldType = new FieldType();
|
||||||
fieldType.setDimensions(numDataDims, numIndexDims, numBytesPerDim);
|
fieldType.setDimensions(numDims, numIndexDims, numBytesPerDim);
|
||||||
fieldType.freeze();
|
fieldType.freeze();
|
||||||
|
|
||||||
Document doc = null;
|
Document doc = null;
|
||||||
|
@ -673,7 +671,7 @@ public abstract class BasePointsFormatTestCase extends BaseIndexFileFormatTestCa
|
||||||
doc.add(new NumericDocValuesField("id", id));
|
doc.add(new NumericDocValuesField("id", id));
|
||||||
}
|
}
|
||||||
// pack the binary point
|
// 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));
|
doc.add(new BinaryPoint("field", val, fieldType));
|
||||||
lastID = id;
|
lastID = id;
|
||||||
|
@ -693,7 +691,7 @@ public abstract class BasePointsFormatTestCase extends BaseIndexFileFormatTestCa
|
||||||
if (random().nextInt(30) == 17) {
|
if (random().nextInt(30) == 17) {
|
||||||
// randomly index some documents with this field, but we will delete them:
|
// randomly index some documents with this field, but we will delete them:
|
||||||
Document xdoc = new Document();
|
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 BinaryPoint("field", val, fieldType));
|
||||||
xdoc.add(new StringField("nukeme", "yes", Field.Store.NO));
|
xdoc.add(new StringField("nukeme", "yes", Field.Store.NO));
|
||||||
if (useRealWriter) {
|
if (useRealWriter) {
|
||||||
|
@ -716,7 +714,7 @@ public abstract class BasePointsFormatTestCase extends BaseIndexFileFormatTestCa
|
||||||
|
|
||||||
if (VERBOSE) {
|
if (VERBOSE) {
|
||||||
System.out.println(" ord=" + ord + " id=" + id);
|
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]));
|
System.out.println(" dim=" + dim + " value=" + new BytesRef(docValues[ord][dim]));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -77,7 +77,7 @@ public class MismatchedLeafReader extends FilterLeafReader {
|
||||||
oldInfo.getDocValuesType(), // docValuesType
|
oldInfo.getDocValuesType(), // docValuesType
|
||||||
oldInfo.getDocValuesGen(), // dvGen
|
oldInfo.getDocValuesGen(), // dvGen
|
||||||
oldInfo.attributes(), // attributes
|
oldInfo.attributes(), // attributes
|
||||||
oldInfo.getPointDataDimensionCount(), // data dimension count
|
oldInfo.getPointDimensionCount(), // data dimension count
|
||||||
oldInfo.getPointIndexDimensionCount(), // index dimension count
|
oldInfo.getPointIndexDimensionCount(), // index dimension count
|
||||||
oldInfo.getPointNumBytes(), // dimension numBytes
|
oldInfo.getPointNumBytes(), // dimension numBytes
|
||||||
oldInfo.isSoftDeletesField()); // used as soft-deletes field
|
oldInfo.isSoftDeletesField()); // used as soft-deletes field
|
||||||
|
|
|
@ -110,7 +110,7 @@ public class RandomCodec extends AssertingCodec {
|
||||||
try (BKDWriter writer = new RandomlySplittingBKDWriter(writeState.segmentInfo.maxDoc(),
|
try (BKDWriter writer = new RandomlySplittingBKDWriter(writeState.segmentInfo.maxDoc(),
|
||||||
writeState.directory,
|
writeState.directory,
|
||||||
writeState.segmentInfo.name,
|
writeState.segmentInfo.name,
|
||||||
fieldInfo.getPointDataDimensionCount(),
|
fieldInfo.getPointDimensionCount(),
|
||||||
fieldInfo.getPointIndexDimensionCount(),
|
fieldInfo.getPointIndexDimensionCount(),
|
||||||
fieldInfo.getPointNumBytes(),
|
fieldInfo.getPointNumBytes(),
|
||||||
maxPointsInLeafNode,
|
maxPointsInLeafNode,
|
||||||
|
|
|
@ -2677,10 +2677,10 @@ public abstract class LuceneTestCase extends Assert {
|
||||||
FieldInfos fieldInfos1 = FieldInfos.getMergedFieldInfos(leftReader);
|
FieldInfos fieldInfos1 = FieldInfos.getMergedFieldInfos(leftReader);
|
||||||
FieldInfos fieldInfos2 = FieldInfos.getMergedFieldInfos(rightReader);
|
FieldInfos fieldInfos2 = FieldInfos.getMergedFieldInfos(rightReader);
|
||||||
for(FieldInfo fieldInfo1 : fieldInfos1) {
|
for(FieldInfo fieldInfo1 : fieldInfos1) {
|
||||||
if (fieldInfo1.getPointDataDimensionCount() != 0) {
|
if (fieldInfo1.getPointDimensionCount() != 0) {
|
||||||
FieldInfo fieldInfo2 = fieldInfos2.fieldInfo(fieldInfo1.name);
|
FieldInfo fieldInfo2 = fieldInfos2.fieldInfo(fieldInfo1.name);
|
||||||
// same data dimension count?
|
// same data dimension count?
|
||||||
assertEquals(info, fieldInfo2.getPointDataDimensionCount(), fieldInfo2.getPointDataDimensionCount());
|
assertEquals(info, fieldInfo2.getPointDimensionCount(), fieldInfo2.getPointDimensionCount());
|
||||||
// same index dimension count?
|
// same index dimension count?
|
||||||
assertEquals(info, fieldInfo2.getPointIndexDimensionCount(), fieldInfo2.getPointIndexDimensionCount());
|
assertEquals(info, fieldInfo2.getPointIndexDimensionCount(), fieldInfo2.getPointIndexDimensionCount());
|
||||||
// same bytes per dimension?
|
// 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 have
|
// make sure FieldInfos2 doesn't have any point fields that FieldInfo1 didn't have
|
||||||
for(FieldInfo fieldInfo2 : fieldInfos2) {
|
for(FieldInfo fieldInfo2 : fieldInfos2) {
|
||||||
if (fieldInfo2.getPointDataDimensionCount() != 0) {
|
if (fieldInfo2.getPointDimensionCount() != 0) {
|
||||||
FieldInfo fieldInfo1 = fieldInfos1.fieldInfo(fieldInfo2.name);
|
FieldInfo fieldInfo1 = fieldInfos1.fieldInfo(fieldInfo2.name);
|
||||||
// same data dimension count?
|
// same data dimension count?
|
||||||
assertEquals(info, fieldInfo2.getPointDataDimensionCount(), fieldInfo1.getPointDataDimensionCount());
|
assertEquals(info, fieldInfo2.getPointDimensionCount(), fieldInfo1.getPointDimensionCount());
|
||||||
// same index dimension count?
|
// same index dimension count?
|
||||||
assertEquals(info, fieldInfo2.getPointIndexDimensionCount(), fieldInfo1.getPointIndexDimensionCount());
|
assertEquals(info, fieldInfo2.getPointIndexDimensionCount(), fieldInfo1.getPointIndexDimensionCount());
|
||||||
// same bytes per dimension?
|
// same bytes per dimension?
|
||||||
|
|
|
@ -1088,7 +1088,7 @@ public final class TestUtil {
|
||||||
final Field field1 = (Field) f;
|
final Field field1 = (Field) f;
|
||||||
final Field field2;
|
final Field field2;
|
||||||
final DocValuesType dvType = field1.fieldType().docValuesType();
|
final DocValuesType dvType = field1.fieldType().docValuesType();
|
||||||
final int dimCount = field1.fieldType().pointDataDimensionCount();
|
final int dimCount = field1.fieldType().pointDimensionCount();
|
||||||
if (dvType != DocValuesType.NONE) {
|
if (dvType != DocValuesType.NONE) {
|
||||||
switch(dvType) {
|
switch(dvType) {
|
||||||
case NUMERIC:
|
case NUMERIC:
|
||||||
|
|
|
@ -376,9 +376,9 @@ public class SegmentsInfoRequestHandler extends RequestHandlerBase {
|
||||||
|
|
||||||
flags.append( (fi.hasPayloads() ? "p" : "-"));
|
flags.append( (fi.hasPayloads() ? "p" : "-"));
|
||||||
flags.append( (fi.isSoftDeletesField() ? "s" : "-"));
|
flags.append( (fi.isSoftDeletesField() ? "s" : "-"));
|
||||||
if (fi.getPointDataDimensionCount() > 0 || fi.getPointIndexDimensionCount() > 0) {
|
if (fi.getPointDimensionCount() > 0 || fi.getPointIndexDimensionCount() > 0) {
|
||||||
flags.append(":");
|
flags.append(":");
|
||||||
flags.append(fi.getPointDataDimensionCount()).append(':');
|
flags.append(fi.getPointDimensionCount()).append(':');
|
||||||
flags.append(fi.getPointIndexDimensionCount()).append(':');
|
flags.append(fi.getPointIndexDimensionCount()).append(':');
|
||||||
flags.append(fi.getPointNumBytes());
|
flags.append(fi.getPointNumBytes());
|
||||||
}
|
}
|
||||||
|
@ -403,7 +403,7 @@ public class SegmentsInfoRequestHandler extends RequestHandlerBase {
|
||||||
|
|
||||||
// check compliance of the index with the current schema
|
// check compliance of the index with the current schema
|
||||||
SchemaField sf = schema.getFieldOrNull(fi.name);
|
SchemaField sf = schema.getFieldOrNull(fi.name);
|
||||||
boolean hasPoints = fi.getPointDataDimensionCount() > 0 || fi.getPointIndexDimensionCount() > 0;
|
boolean hasPoints = fi.getPointDimensionCount() > 0 || fi.getPointIndexDimensionCount() > 0;
|
||||||
|
|
||||||
if (sf != null) {
|
if (sf != null) {
|
||||||
fieldFlags.add("schemaType", sf.getType().getTypeName());
|
fieldFlags.add("schemaType", sf.getType().getTypeName());
|
||||||
|
|
|
@ -173,7 +173,7 @@ public class BBoxStrategy extends SpatialStrategy {
|
||||||
if ((this.hasDocVals = fieldType.docValuesType() != DocValuesType.NONE)) {
|
if ((this.hasDocVals = fieldType.docValuesType() != DocValuesType.NONE)) {
|
||||||
numQuads++;
|
numQuads++;
|
||||||
}
|
}
|
||||||
if ((this.hasPointVals = fieldType.pointDataDimensionCount() > 0)) {
|
if ((this.hasPointVals = fieldType.pointDimensionCount() > 0)) {
|
||||||
numQuads++;
|
numQuads++;
|
||||||
}
|
}
|
||||||
if (fieldType.indexOptions() != IndexOptions.NONE && fieldType instanceof LegacyFieldType && ((LegacyFieldType)fieldType).numericType() != null) {
|
if (fieldType.indexOptions() != IndexOptions.NONE && fieldType instanceof LegacyFieldType && ((LegacyFieldType)fieldType).numericType() != null) {
|
||||||
|
|
|
@ -152,7 +152,7 @@ public class PointVectorStrategy extends SpatialStrategy {
|
||||||
if ((this.hasDocVals = fieldType.docValuesType() != DocValuesType.NONE)) {
|
if ((this.hasDocVals = fieldType.docValuesType() != DocValuesType.NONE)) {
|
||||||
numPairs++;
|
numPairs++;
|
||||||
}
|
}
|
||||||
if ((this.hasPointVals = fieldType.pointDataDimensionCount() > 0)) {
|
if ((this.hasPointVals = fieldType.pointDimensionCount() > 0)) {
|
||||||
numPairs++;
|
numPairs++;
|
||||||
}
|
}
|
||||||
if (fieldType.indexOptions() != IndexOptions.NONE && fieldType instanceof LegacyFieldType && ((LegacyFieldType)fieldType).numericType() != null) {
|
if (fieldType.indexOptions() != IndexOptions.NONE && fieldType instanceof LegacyFieldType && ((LegacyFieldType)fieldType).numericType() != null) {
|
||||||
|
|
|
@ -433,7 +433,7 @@ public final class SchemaField extends FieldProperties implements IndexableField
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int pointDataDimensionCount() {
|
public int pointDimensionCount() {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -442,7 +442,7 @@ public class CollapsingQParserPlugin extends QParserPlugin {
|
||||||
DocValuesType.NONE,
|
DocValuesType.NONE,
|
||||||
fieldInfo.getDocValuesGen(),
|
fieldInfo.getDocValuesGen(),
|
||||||
fieldInfo.attributes(),
|
fieldInfo.attributes(),
|
||||||
fieldInfo.getPointDataDimensionCount(),
|
fieldInfo.getPointDimensionCount(),
|
||||||
fieldInfo.getPointIndexDimensionCount(),
|
fieldInfo.getPointIndexDimensionCount(),
|
||||||
fieldInfo.getPointNumBytes(),
|
fieldInfo.getPointNumBytes(),
|
||||||
fieldInfo.isSoftDeletesField());
|
fieldInfo.isSoftDeletesField());
|
||||||
|
|
|
@ -67,7 +67,7 @@ public class Insanity {
|
||||||
if (fi.name.equals(insaneField)) {
|
if (fi.name.equals(insaneField)) {
|
||||||
filteredInfos.add(new FieldInfo(fi.name, fi.number, fi.hasVectors(), fi.omitsNorms(),
|
filteredInfos.add(new FieldInfo(fi.name, fi.number, fi.hasVectors(), fi.omitsNorms(),
|
||||||
fi.hasPayloads(), fi.getIndexOptions(), DocValuesType.NONE, -1, Collections.emptyMap(),
|
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 {
|
} else {
|
||||||
filteredInfos.add(fi);
|
filteredInfos.add(fi);
|
||||||
}
|
}
|
||||||
|
|
|
@ -592,11 +592,11 @@ public class FieldCacheImpl implements FieldCache {
|
||||||
if (parser instanceof PointParser) {
|
if (parser instanceof PointParser) {
|
||||||
// points case
|
// points case
|
||||||
// no points in this segment
|
// no points in this segment
|
||||||
if (info.getPointDataDimensionCount() == 0) {
|
if (info.getPointDimensionCount() == 0) {
|
||||||
return DocValues.emptyNumeric();
|
return DocValues.emptyNumeric();
|
||||||
}
|
}
|
||||||
if (info.getPointDataDimensionCount() != 1) {
|
if (info.getPointDimensionCount() != 1) {
|
||||||
throw new IllegalStateException("Type mismatch: " + field + " was indexed with dimensions=" + info.getPointDataDimensionCount());
|
throw new IllegalStateException("Type mismatch: " + field + " was indexed with dimensions=" + info.getPointDimensionCount());
|
||||||
}
|
}
|
||||||
PointValues values = reader.getPointValues(field);
|
PointValues values = reader.getPointValues(field);
|
||||||
// no actual points for this field (e.g. all points deleted)
|
// no actual points for this field (e.g. all points deleted)
|
||||||
|
|
|
@ -237,12 +237,12 @@ public class UninvertingReader extends FilterLeafReader {
|
||||||
DocValuesType type = fi.getDocValuesType();
|
DocValuesType type = fi.getDocValuesType();
|
||||||
// fields which currently don't have docValues, but are uninvertable (indexed or points data present)
|
// fields which currently don't have docValues, but are uninvertable (indexed or points data present)
|
||||||
if (type == DocValuesType.NONE &&
|
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 it
|
Type t = mapping.apply(fi.name); // could definitely return null, thus still can't uninvert it
|
||||||
if (t != null) {
|
if (t != null) {
|
||||||
if (t == Type.INTEGER_POINT || t == Type.LONG_POINT || t == Type.FLOAT_POINT || t == Type.DOUBLE_POINT) {
|
if (t == Type.INTEGER_POINT || t == Type.LONG_POINT || t == Type.FLOAT_POINT || t == Type.DOUBLE_POINT) {
|
||||||
// type uses points
|
// type uses points
|
||||||
if (fi.getPointDataDimensionCount() == 0) {
|
if (fi.getPointDimensionCount() == 0) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -284,7 +284,7 @@ public class UninvertingReader extends FilterLeafReader {
|
||||||
wrap = true;
|
wrap = true;
|
||||||
newFieldInfos.add(new FieldInfo(fi.name, fi.number, fi.hasVectors(), fi.omitsNorms(),
|
newFieldInfos.add(new FieldInfo(fi.name, fi.number, fi.hasVectors(), fi.omitsNorms(),
|
||||||
fi.hasPayloads(), fi.getIndexOptions(), type, fi.getDocValuesGen(), fi.attributes(),
|
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 {
|
} else {
|
||||||
newFieldInfos.add(fi);
|
newFieldInfos.add(fi);
|
||||||
}
|
}
|
||||||
|
|
|
@ -379,13 +379,13 @@ public class TestUninvertingReader extends SolrTestCase {
|
||||||
|
|
||||||
FieldInfo intFInfo = fieldInfos.fieldInfo("int");
|
FieldInfo intFInfo = fieldInfos.fieldInfo("int");
|
||||||
assertEquals(DocValuesType.NUMERIC, intFInfo.getDocValuesType());
|
assertEquals(DocValuesType.NUMERIC, intFInfo.getDocValuesType());
|
||||||
assertEquals(0, intFInfo.getPointDataDimensionCount());
|
assertEquals(0, intFInfo.getPointDimensionCount());
|
||||||
assertEquals(0, intFInfo.getPointIndexDimensionCount());
|
assertEquals(0, intFInfo.getPointIndexDimensionCount());
|
||||||
assertEquals(0, intFInfo.getPointNumBytes());
|
assertEquals(0, intFInfo.getPointNumBytes());
|
||||||
|
|
||||||
FieldInfo dintFInfo = fieldInfos.fieldInfo("dint");
|
FieldInfo dintFInfo = fieldInfos.fieldInfo("dint");
|
||||||
assertEquals(DocValuesType.NUMERIC, dintFInfo.getDocValuesType());
|
assertEquals(DocValuesType.NUMERIC, dintFInfo.getDocValuesType());
|
||||||
assertEquals(1, dintFInfo.getPointDataDimensionCount());
|
assertEquals(1, dintFInfo.getPointDimensionCount());
|
||||||
assertEquals(1, dintFInfo.getPointIndexDimensionCount());
|
assertEquals(1, dintFInfo.getPointIndexDimensionCount());
|
||||||
assertEquals(4, dintFInfo.getPointNumBytes());
|
assertEquals(4, dintFInfo.getPointNumBytes());
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue