void setStoreTermVectors() { storeTermVector = true; assert checkConsistency(); }
/** Sets the docValues generation of this field. */ void setDocValuesGen(long dvGen) { this.dvGen = dvGen; assert checkConsistency(); }
/** Record that this field is indexed with docvalues, with the specified type */ public void setDocValuesType(DocValuesType type) { if (type == null) { throw new NullPointerException("DocValuesType must not be null (field: \"" + name + "\")"); } if (docValuesType != DocValuesType.NONE && type != DocValuesType.NONE && docValuesType != type) { throw new IllegalArgumentException("cannot change DocValues type from " + docValuesType + " to " + type + " for field \"" + name + "\""); } docValuesType = type; assert checkConsistency(); }
void setStorePayloads() { if (indexOptions != IndexOptions.NONE && indexOptions.compareTo(IndexOptions.DOCS_AND_FREQS_AND_POSITIONS) >= 0) { storePayloads = true; } assert checkConsistency(); }
/** * Sole constructor. * * @lucene.experimental */ public FieldInfo(String name, int number, boolean storeTermVector, boolean omitNorms, boolean storePayloads, IndexOptions indexOptions, DocValuesType docValues, long dvGen, Map<String,String> attributes, int pointDataDimensionCount, int pointIndexDimensionCount, int pointNumBytes, boolean softDeletesField) { this.name = Objects.requireNonNull(name); this.number = number; this.docValuesType = Objects.requireNonNull(docValues, "DocValuesType must not be null (field: \"" + name + "\")"); this.indexOptions = Objects.requireNonNull(indexOptions, "IndexOptions must not be null (field: \"" + name + "\")"); if (indexOptions != IndexOptions.NONE) { this.storeTermVector = storeTermVector; this.storePayloads = storePayloads; this.omitNorms = omitNorms; } else { // for non-indexed fields, leave defaults this.storeTermVector = false; this.storePayloads = false; this.omitNorms = false; } this.dvGen = dvGen; this.attributes = Objects.requireNonNull(attributes); this.pointDataDimensionCount = pointDataDimensionCount; this.pointIndexDimensionCount = pointIndexDimensionCount; this.pointNumBytes = pointNumBytes; this.softDeletesField = softDeletesField; assert checkConsistency(); }
pointNumBytes = numBytes; assert checkConsistency();
infos[i] = new FieldInfo(name, fieldNumber, storeTermVector, omitNorms, storePayloads, indexOptions, docValuesType, dvGen, attributes, 0, 0, 0, false); infos[i].checkConsistency(); } catch (IllegalStateException e) { throw new CorruptIndexException("invalid fieldinfo for field: " + name + ", fieldNumber=" + fieldNumber, input, e);
indexOptions, docValuesType, dvGen, attributes, pointDataDimensionCount, pointIndexDimensionCount, pointNumBytes, isSoftDeletesField); infos[i].checkConsistency(); } catch (IllegalStateException e) { throw new CorruptIndexException("invalid fieldinfo for field: " + name + ", fieldNumber=" + fieldNumber, input, e);
@Override public void write(Directory directory, SegmentInfo segmentInfo, String segmentSuffix, FieldInfos infos, IOContext context) throws IOException { final String fileName = IndexFileNames.segmentFileName(segmentInfo.name, segmentSuffix, EXTENSION); try (IndexOutput output = directory.createOutput(fileName, context)) { CodecUtil.writeIndexHeader(output, Lucene50FieldInfosFormat.CODEC_NAME, Lucene50FieldInfosFormat.FORMAT_CURRENT, segmentInfo.getId(), segmentSuffix); output.writeVInt(infos.size()); for (FieldInfo fi : infos) { fi.checkConsistency(); output.writeString(fi.name); output.writeVInt(fi.number); byte bits = 0x0; if (fi.hasVectors()) bits |= STORE_TERMVECTOR; if (fi.omitsNorms()) bits |= OMIT_NORMS; if (fi.hasPayloads()) bits |= STORE_PAYLOADS; output.writeByte(bits); output.writeByte(indexOptionsByte(fi.getIndexOptions())); // pack the DV type and hasNorms in one byte output.writeByte(docValuesByte(fi.getDocValuesType())); output.writeLong(fi.getDocValuesGen()); output.writeMapOfStrings(fi.attributes()); } CodecUtil.writeFooter(output); } }
output.writeVInt(infos.size()); for (FieldInfo fi : infos) { fi.checkConsistency();
/** Sets the docValues generation of this field. */ void setDocValuesGen(long dvGen) { this.dvGen = dvGen; assert checkConsistency(); }
/** Sets the docValues generation of this field. */ void setDocValuesGen(long dvGen) { this.dvGen = dvGen; assert checkConsistency(); }
void setStoreTermVectors() { storeTermVector = true; assert checkConsistency(); }
void setDocValuesType(DocValuesType type) { if (type == null) { throw new NullPointerException("DocValuesType cannot be null (field: \"" + name + "\")"); } if (docValuesType != DocValuesType.NONE && type != DocValuesType.NONE && docValuesType != type) { throw new IllegalArgumentException("cannot change DocValues type from " + docValuesType + " to " + type + " for field \"" + name + "\""); } docValuesType = type; assert checkConsistency(); }
/** Record that this field is indexed with docvalues, with the specified type */ public void setDocValuesType(DocValuesType type) { if (type == null) { throw new NullPointerException("DocValuesType must not be null (field: \"" + name + "\")"); } if (docValuesType != DocValuesType.NONE && type != DocValuesType.NONE && docValuesType != type) { throw new IllegalArgumentException("cannot change DocValues type from " + docValuesType + " to " + type + " for field \"" + name + "\""); } docValuesType = type; assert checkConsistency(); }
void setDocValuesType(DocValuesType type) { if (type == null) { throw new NullPointerException("DocValuesType cannot be null (field: \"" + name + "\")"); } if (docValuesType != DocValuesType.NONE && type != DocValuesType.NONE && docValuesType != type) { throw new IllegalArgumentException("cannot change DocValues type from " + docValuesType + " to " + type + " for field \"" + name + "\""); } docValuesType = type; assert checkConsistency(); }
void setStorePayloads() { if (indexOptions != IndexOptions.NONE && indexOptions.compareTo(IndexOptions.DOCS_AND_FREQS_AND_POSITIONS) >= 0) { storePayloads = true; } assert checkConsistency(); }
public FieldInfo toFieldInfo() { FieldInfo fi = new FieldInfo(this.name, this.fieldNumber, this.storeTermVector, this.omitNorms, this.storePayloads, this.indexOptions, this.docValuesType, this.dvGen, this.attributes, this.pointDimensionCount, this.pointNumBytes); fi.checkConsistency(); return fi; }