Java Code Examples for org.apache.lucene.codecs.FieldInfosFormat

The following examples show how to use org.apache.lucene.codecs.FieldInfosFormat. These examples are extracted from open source projects. 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 Project: lucene-solr   Source File: PendingSoftDeletes.java    License: 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 Project: lucene-solr   Source File: SegmentReader.java    License: 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 Project: lucene-solr   Source File: ReadersAndUpdates.java    License: 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 Project: lucene-solr   Source File: SimpleTextCodec.java    License: Apache License 2.0 4 votes vote down vote up
@Override
public FieldInfosFormat fieldInfosFormat() {
  return fieldInfosFormat;
}
 
Example 5
Source Project: lucene-solr   Source File: CrankyCodec.java    License: Apache License 2.0 4 votes vote down vote up
@Override
public FieldInfosFormat fieldInfosFormat() {
  return new CrankyFieldInfosFormat(delegate.fieldInfosFormat(), random);
}
 
Example 6
Source Project: lucene-solr   Source File: CrankyFieldInfosFormat.java    License: Apache License 2.0 4 votes vote down vote up
CrankyFieldInfosFormat(FieldInfosFormat delegate, Random random) {
  this.delegate = delegate;
  this.random = random;
}
 
Example 7
Source Project: lucene-solr   Source File: Lucene86Codec.java    License: Apache License 2.0 4 votes vote down vote up
@Override
public final FieldInfosFormat fieldInfosFormat() {
  return fieldInfosFormat;
}
 
Example 8
Source Project: lucene-solr   Source File: Lucene80Codec.java    License: Apache License 2.0 4 votes vote down vote up
@Override
public final FieldInfosFormat fieldInfosFormat() {
  return fieldInfosFormat;
}
 
Example 9
Source Project: lucene-solr   Source File: Lucene84Codec.java    License: Apache License 2.0 4 votes vote down vote up
@Override
public final FieldInfosFormat fieldInfosFormat() {
  return fieldInfosFormat;
}
 
Example 10
Source Project: mtas   Source File: MtasCodec.java    License: Apache License 2.0 4 votes vote down vote up
@Override
public FieldInfosFormat fieldInfosFormat() {
  initDelegate();
  return delegate.fieldInfosFormat();
}
 
Example 11
Source Project: incubator-retired-blur   Source File: Blur021Codec.java    License: Apache License 2.0 4 votes vote down vote up
@Override
public final FieldInfosFormat fieldInfosFormat() {
  return fieldInfosFormat;
}
 
Example 12
Source Project: incubator-retired-blur   Source File: Blur022Codec.java    License: Apache License 2.0 4 votes vote down vote up
@Override
public final FieldInfosFormat fieldInfosFormat() {
  return fieldInfosFormat;
}
 
Example 13
Source Project: incubator-retired-blur   Source File: Blur024Codec.java    License: Apache License 2.0 4 votes vote down vote up
@Override
public final FieldInfosFormat fieldInfosFormat() {
  return fieldInfosFormat;
}