org.apache.lucene.codecs.FieldInfosFormat Java Examples

The following examples show how to use org.apache.lucene.codecs.FieldInfosFormat. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: PendingSoftDeletes.java    From lucene-solr with Apache License 2.0 6 votes vote down vote up
private FieldInfos readFieldInfos() throws IOException {
  SegmentInfo segInfo = info.info;
  Directory dir = segInfo.dir;
  if (info.hasFieldUpdates() == false) {
    // updates always outside of CFS
    Closeable toClose;
    if (segInfo.getUseCompoundFile()) {
      toClose = dir = segInfo.getCodec().compoundFormat().getCompoundReader(segInfo.dir, segInfo, IOContext.READONCE);
    } else {
      toClose = null;
      dir = segInfo.dir;
    }
    try {
      return segInfo.getCodec().fieldInfosFormat().read(dir, segInfo, "", IOContext.READONCE);
    } finally {
      IOUtils.close(toClose);
    }
  } else {
    FieldInfosFormat fisFormat = segInfo.getCodec().fieldInfosFormat();
    final String segmentSuffix = Long.toString(info.getFieldInfosGen(), Character.MAX_RADIX);
    return fisFormat.read(dir, segInfo, segmentSuffix, IOContext.READONCE);
  }
}
 
Example #2
Source File: SegmentReader.java    From lucene-solr with Apache License 2.0 5 votes vote down vote up
/**
 * init most recent FieldInfos for the current commit
 */
private FieldInfos initFieldInfos() throws IOException {
  if (!si.hasFieldUpdates()) {
    return core.coreFieldInfos;
  } else {
    // updates always outside of CFS
    FieldInfosFormat fisFormat = si.info.getCodec().fieldInfosFormat();
    final String segmentSuffix = Long.toString(si.getFieldInfosGen(), Character.MAX_RADIX);
    return fisFormat.read(si.info.dir, si.info, segmentSuffix, IOContext.READONCE);
  }
}
 
Example #3
Source File: ReadersAndUpdates.java    From lucene-solr with Apache License 2.0 5 votes vote down vote up
private synchronized Set<String> writeFieldInfosGen(FieldInfos fieldInfos, Directory dir,
                                                    FieldInfosFormat infosFormat) throws IOException {
  final long nextFieldInfosGen = info.getNextFieldInfosGen();
  final String segmentSuffix = Long.toString(nextFieldInfosGen, Character.MAX_RADIX);
  // we write approximately that many bytes (based on Lucene46DVF):
  // HEADER + FOOTER: 40
  // 90 bytes per-field (over estimating long name and attributes map)
  final long estInfosSize = 40 + 90 * fieldInfos.size();
  final IOContext infosContext = new IOContext(new FlushInfo(info.info.maxDoc(), estInfosSize));
  // separately also track which files were created for this gen
  final TrackingDirectoryWrapper trackingDir = new TrackingDirectoryWrapper(dir);
  infosFormat.write(trackingDir, info.info, segmentSuffix, fieldInfos, infosContext);
  info.advanceFieldInfosGen();
  return trackingDir.getCreatedFiles();
}
 
Example #4
Source File: SimpleTextCodec.java    From lucene-solr with Apache License 2.0 4 votes vote down vote up
@Override
public FieldInfosFormat fieldInfosFormat() {
  return fieldInfosFormat;
}
 
Example #5
Source File: CrankyCodec.java    From lucene-solr with Apache License 2.0 4 votes vote down vote up
@Override
public FieldInfosFormat fieldInfosFormat() {
  return new CrankyFieldInfosFormat(delegate.fieldInfosFormat(), random);
}
 
Example #6
Source File: CrankyFieldInfosFormat.java    From lucene-solr with Apache License 2.0 4 votes vote down vote up
CrankyFieldInfosFormat(FieldInfosFormat delegate, Random random) {
  this.delegate = delegate;
  this.random = random;
}
 
Example #7
Source File: Lucene86Codec.java    From lucene-solr with Apache License 2.0 4 votes vote down vote up
@Override
public final FieldInfosFormat fieldInfosFormat() {
  return fieldInfosFormat;
}
 
Example #8
Source File: Lucene80Codec.java    From lucene-solr with Apache License 2.0 4 votes vote down vote up
@Override
public final FieldInfosFormat fieldInfosFormat() {
  return fieldInfosFormat;
}
 
Example #9
Source File: Lucene84Codec.java    From lucene-solr with Apache License 2.0 4 votes vote down vote up
@Override
public final FieldInfosFormat fieldInfosFormat() {
  return fieldInfosFormat;
}
 
Example #10
Source File: MtasCodec.java    From mtas with Apache License 2.0 4 votes vote down vote up
@Override
public FieldInfosFormat fieldInfosFormat() {
  initDelegate();
  return delegate.fieldInfosFormat();
}
 
Example #11
Source File: Blur021Codec.java    From incubator-retired-blur with Apache License 2.0 4 votes vote down vote up
@Override
public final FieldInfosFormat fieldInfosFormat() {
  return fieldInfosFormat;
}
 
Example #12
Source File: Blur022Codec.java    From incubator-retired-blur with Apache License 2.0 4 votes vote down vote up
@Override
public final FieldInfosFormat fieldInfosFormat() {
  return fieldInfosFormat;
}
 
Example #13
Source File: Blur024Codec.java    From incubator-retired-blur with Apache License 2.0 4 votes vote down vote up
@Override
public final FieldInfosFormat fieldInfosFormat() {
  return fieldInfosFormat;
}