/** Check indexed field info against the provided query data. */ private void checkFieldInfo(FieldInfo fieldInfo) { if (fieldInfo.getPointDataDimensionCount()/2 != numDims) { throw new IllegalArgumentException("field=\"" + field + "\" was indexed with numDims=" + fieldInfo.getPointDataDimensionCount()/2 + " but this query has numDims=" + numDims); } }
/** Returns the underlying {@link BKDReader}. * * @lucene.internal */ @Override public PointValues getValues(String fieldName) { FieldInfo fieldInfo = readState.fieldInfos.fieldInfo(fieldName); if (fieldInfo == null) { throw new IllegalArgumentException("field=\"" + fieldName + "\" is unrecognized"); } if (fieldInfo.getPointDataDimensionCount() == 0) { throw new IllegalArgumentException("field=\"" + fieldName + "\" did not index point values"); } return readers.get(fieldInfo.number); }
/** helper: checks a fieldinfo and throws exception if its definitely not a LatLonPoint */ static void checkCompatible(FieldInfo fieldInfo) { // point/dv properties could be "unset", if you e.g. used only StoredField with this same name in the segment. if (fieldInfo.getPointDataDimensionCount() != 0 && fieldInfo.getPointDataDimensionCount() != TYPE.pointDataDimensionCount()) { throw new IllegalArgumentException("field=\"" + fieldInfo.name + "\" was indexed with numDims=" + fieldInfo.getPointDataDimensionCount() + " but this point type has numDims=" + TYPE.pointDataDimensionCount() + ", is the field really a LatLonPoint?"); } if (fieldInfo.getPointNumBytes() != 0 && fieldInfo.getPointNumBytes() != TYPE.pointNumBytes()) { throw new IllegalArgumentException("field=\"" + fieldInfo.name + "\" was indexed with bytesPerDim=" + fieldInfo.getPointNumBytes() + " but this point type has bytesPerDim=" + TYPE.pointNumBytes() + ", is the field really a LatLonPoint?"); } }
public PointValuesWriter(DocumentsWriterPerThread docWriter, FieldInfo fieldInfo) { this.fieldInfo = fieldInfo; this.iwBytesUsed = docWriter.bytesUsed; this.bytes = new ByteBlockPool(docWriter.byteBlockAllocator); docIDs = new int[16]; iwBytesUsed.addAndGet(16 * Integer.BYTES); packedBytesLength = fieldInfo.getPointDataDimensionCount() * fieldInfo.getPointNumBytes(); }
public void addPackedValue(int docID, BytesRef value) { if (value == null) { throw new IllegalArgumentException("field=" + fieldInfo.name + ": point value must not be null"); } if (value.length != packedBytesLength) { throw new IllegalArgumentException("field=" + fieldInfo.name + ": this field's value has length=" + value.length + " but should be " + (fieldInfo.getPointDataDimensionCount() * fieldInfo.getPointNumBytes())); } if (docIDs.length == numPoints) { docIDs = ArrayUtil.grow(docIDs, numPoints+1); iwBytesUsed.addAndGet((docIDs.length - numPoints) * Integer.BYTES); } bytes.append(value); docIDs[numPoints] = docID; if (docID != lastDocID) { numDocs++; lastDocID = docID; } numPoints++; }
/** Default merge implementation to merge incoming points readers by visiting all their points and * adding to this writer */ public void merge(MergeState mergeState) throws IOException { // check each incoming reader for (PointsReader reader : mergeState.pointsReaders) { if (reader != null) { reader.checkIntegrity(); } } // merge field at a time for (FieldInfo fieldInfo : mergeState.mergeFieldInfos) { if (fieldInfo.getPointDataDimensionCount() != 0) { mergeOneField(mergeState, fieldInfo); } } finish(); }
while (perField != null) { if (perField.pointValuesWriter != null) { if (perField.fieldInfo.getPointDataDimensionCount() == 0) { } else if (perField.fieldInfo.getPointDataDimensionCount() != 0) {
@Override public final PointValues getPointValues(String field) throws IOException { ensureOpen(); FieldInfo fi = getFieldInfos().fieldInfo(field); if (fi == null || fi.getPointDataDimensionCount() == 0) { // Field does not exist or does not index points return null; } return getPointsReader().getValues(field); }
if (fieldInfo.getPointDataDimensionCount() != 0) { if (fieldInfo.getPointDataDimensionCount() == 1) { FieldInfos readerFieldInfos = mergeState.fieldInfos[i]; FieldInfo readerFieldInfo = readerFieldInfos.fieldInfo(fieldInfo.name); if (readerFieldInfo != null && readerFieldInfo.getPointDataDimensionCount() > 0) { PointValues values = reader.getValues(fieldInfo.name); if (values != null) { writeState.directory, writeState.segmentInfo.name, fieldInfo.getPointDataDimensionCount(), fieldInfo.getPointIndexDimensionCount(), fieldInfo.getPointNumBytes(), if (readerFieldInfo != null && readerFieldInfo.getPointDataDimensionCount() > 0) { BKDReader bkdReader = reader60.readers.get(readerFieldInfo.number); if (bkdReader != null) {
hasDocValues |= fi.getDocValuesType() != DocValuesType.NONE; hasPayloads |= fi.hasPayloads(); hasPointValues |= (fi.getPointDataDimensionCount() != 0);
hasDocValues |= info.getDocValuesType() != DocValuesType.NONE; hasPayloads |= info.hasPayloads(); hasPointValues |= (info.getPointDataDimensionCount() != 0); if (info.isSoftDeletesField()) { if (softDeletesField != null && softDeletesField.equals(info.name) == false) {
/** * Loads or returns the already loaded the global field number map for this {@link SegmentInfos}. * If this {@link SegmentInfos} has no global field number map the returned instance is empty */ private FieldNumbers getFieldNumberMap() throws IOException { final FieldNumbers map = new FieldNumbers(config.softDeletesField); for(SegmentCommitInfo info : segmentInfos) { FieldInfos fis = readFieldInfos(info); for(FieldInfo fi : fis) { map.addOrGet(fi.name, fi.number, fi.getDocValuesType(), fi.getPointDataDimensionCount(), fi.getPointIndexDimensionCount(), fi.getPointNumBytes(), fi.isSoftDeletesField()); } } return map; }
public FieldInfo add(FieldInfo fi, long dvGen) { // IMPORTANT - reuse the field number if possible for consistent field numbers across segments return addOrUpdateInternal(fi.name, fi.number, fi.hasVectors(), fi.omitsNorms(), fi.hasPayloads(), fi.getIndexOptions(), fi.getDocValuesType(), dvGen, fi.getPointDataDimensionCount(), fi.getPointIndexDimensionCount(), fi.getPointNumBytes(), fi.isSoftDeletesField()); }
if (fieldInfo.getPointDataDimensionCount() > 0) { PointValues values = pointsReader.getValues(fieldInfo.name); if (values == null) {
writeState.directory, writeState.segmentInfo.name, fieldInfo.getPointDataDimensionCount(), fieldInfo.getPointIndexDimensionCount(), fieldInfo.getPointNumBytes(),
if (pointsReader != null) { FieldInfo readerFieldInfo = mergeState.fieldInfos[i].fieldInfo(fieldInfo.name); if (readerFieldInfo != null && readerFieldInfo.getPointDataDimensionCount() > 0) { PointValues values = pointsReader.getValues(fieldInfo.name); if (values != null) {
/** Called from processDocument to index one field's point */ private void indexPoint(PerField fp, IndexableField field) throws IOException { int pointDataDimensionCount = field.fieldType().pointDataDimensionCount(); int pointIndexDimensionCount = field.fieldType().pointIndexDimensionCount(); int dimensionNumBytes = field.fieldType().pointNumBytes(); // Record dimensions for this field; this setter will throw IllegalArgExc if // the dimensions were already set to something different: if (fp.fieldInfo.getPointDataDimensionCount() == 0) { fieldInfos.globalFieldNumbers.setDimensions(fp.fieldInfo.number, fp.fieldInfo.name, pointDataDimensionCount, pointIndexDimensionCount, dimensionNumBytes); } fp.fieldInfo.setPointDimensions(pointDataDimensionCount, pointIndexDimensionCount, dimensionNumBytes); if (fp.pointValuesWriter == null) { fp.pointValuesWriter = new PointValuesWriter(docWriter, fp.fieldInfo); } fp.pointValuesWriter.addPackedValue(docState.docID, field.binaryValue()); }
output.writeLong(fi.getDocValuesGen()); output.writeMapOfStrings(fi.attributes()); output.writeVInt(fi.getPointDataDimensionCount()); if (fi.getPointDataDimensionCount() != 0) { output.writeVInt(fi.getPointIndexDimensionCount()); output.writeVInt(fi.getPointNumBytes());
for(FieldInfo fi : fis) { globalFieldNumberMap.addOrGet(fi.name, fi.number, fi.getDocValuesType(), fi.getPointDataDimensionCount(), fi.getPointIndexDimensionCount(), fi.getPointNumBytes(), fi.isSoftDeletesField());
/** Check indexed field info against the provided query data. */ private void checkFieldInfo(FieldInfo fieldInfo) { if (fieldInfo.getPointDataDimensionCount()/2 != numDims) { throw new IllegalArgumentException("field=\"" + field + "\" was indexed with numDims=" + fieldInfo.getPointDataDimensionCount()/2 + " but this query has numDims=" + numDims); } }