当前位置: 首页>>代码示例>>Java>>正文


Java PostingsWriterBase类代码示例

本文整理汇总了Java中org.apache.lucene.codecs.PostingsWriterBase的典型用法代码示例。如果您正苦于以下问题:Java PostingsWriterBase类的具体用法?Java PostingsWriterBase怎么用?Java PostingsWriterBase使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


PostingsWriterBase类属于org.apache.lucene.codecs包,在下文中一共展示了PostingsWriterBase类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: fieldsConsumer

import org.apache.lucene.codecs.PostingsWriterBase; //导入依赖的package包/类
@Override
public FieldsConsumer fieldsConsumer(SegmentWriteState state) throws IOException {
  PostingsWriterBase postingsWriter = new Lucene41PostingsWriter(state);

  boolean success = false;
  try {
    FieldsConsumer ret = new BlockTreeTermsWriter(state, 
                                                  postingsWriter,
                                                  minTermBlockSize, 
                                                  maxTermBlockSize);
    success = true;
    return ret;
  } finally {
    if (!success) {
      IOUtils.closeWhileHandlingException(postingsWriter);
    }
  }
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:19,代码来源:Lucene41PostingsFormat.java

示例2: FSTTermsWriter

import org.apache.lucene.codecs.PostingsWriterBase; //导入依赖的package包/类
public FSTTermsWriter(SegmentWriteState state, PostingsWriterBase postingsWriter) throws IOException {
  final String termsFileName = IndexFileNames.segmentFileName(state.segmentInfo.name, state.segmentSuffix, TERMS_EXTENSION);

  this.postingsWriter = postingsWriter;
  this.fieldInfos = state.fieldInfos;
  this.out = state.directory.createOutput(termsFileName, state.context);

  boolean success = false;
  try {
    writeHeader(out);
    this.postingsWriter.init(out); 
    success = true;
  } finally {
    if (!success) {
      IOUtils.closeWhileHandlingException(out);
    }
  }
}
 
开发者ID:europeana,项目名称:search,代码行数:19,代码来源:FSTTermsWriter.java

示例3: FSTOrdTermsWriter

import org.apache.lucene.codecs.PostingsWriterBase; //导入依赖的package包/类
public FSTOrdTermsWriter(SegmentWriteState state, PostingsWriterBase postingsWriter) throws IOException {
  final String termsIndexFileName = IndexFileNames.segmentFileName(state.segmentInfo.name, state.segmentSuffix, TERMS_INDEX_EXTENSION);
  final String termsBlockFileName = IndexFileNames.segmentFileName(state.segmentInfo.name, state.segmentSuffix, TERMS_BLOCK_EXTENSION);

  this.postingsWriter = postingsWriter;
  this.fieldInfos = state.fieldInfos;

  boolean success = false;
  try {
    this.indexOut = state.directory.createOutput(termsIndexFileName, state.context);
    this.blockOut = state.directory.createOutput(termsBlockFileName, state.context);
    writeHeader(indexOut);
    writeHeader(blockOut);
    this.postingsWriter.init(blockOut); 
    success = true;
  } finally {
    if (!success) {
      IOUtils.closeWhileHandlingException(indexOut, blockOut);
    }
  }
}
 
开发者ID:europeana,项目名称:search,代码行数:22,代码来源:FSTOrdTermsWriter.java

示例4: fieldsConsumer

import org.apache.lucene.codecs.PostingsWriterBase; //导入依赖的package包/类
@Override
public FieldsConsumer fieldsConsumer(SegmentWriteState state) throws IOException {
  PostingsWriterBase postingsWriter = new Lucene41PostingsWriter(state);

  boolean success = false;
  try {
    FieldsConsumer ret = new OrdsBlockTreeTermsWriter(state, 
                                                      postingsWriter,
                                                      minTermBlockSize, 
                                                      maxTermBlockSize);
    success = true;
    return ret;
  } finally {
    if (!success) {
      IOUtils.closeWhileHandlingException(postingsWriter);
    }
  }
}
 
开发者ID:europeana,项目名称:search,代码行数:19,代码来源:Ords41PostingsFormat.java

示例5: BlockTermsWriter

import org.apache.lucene.codecs.PostingsWriterBase; //导入依赖的package包/类
public BlockTermsWriter(TermsIndexWriterBase termsIndexWriter,
    SegmentWriteState state, PostingsWriterBase postingsWriter)
    throws IOException {
  final String termsFileName = IndexFileNames.segmentFileName(state.segmentInfo.name, state.segmentSuffix, TERMS_EXTENSION);
  this.termsIndexWriter = termsIndexWriter;
  out = state.directory.createOutput(termsFileName, state.context);
  boolean success = false;
  try {
    fieldInfos = state.fieldInfos;
    writeHeader(out);
    currentField = null;
    this.postingsWriter = postingsWriter;
    // segment = state.segmentName;
    
    //System.out.println("BTW.init seg=" + state.segmentName);
    
    postingsWriter.init(out); // have consumer write its format/header
    success = true;
  } finally {
    if (!success) {
      IOUtils.closeWhileHandlingException(out);
    }
  }
}
 
开发者ID:europeana,项目名称:search,代码行数:25,代码来源:BlockTermsWriter.java

示例6: fieldsConsumer

import org.apache.lucene.codecs.PostingsWriterBase; //导入依赖的package包/类
@Override
public FieldsConsumer fieldsConsumer(SegmentWriteState state) throws IOException {
  PostingsWriterBase docsWriter = null;

  // Terms that have <= freqCutoff number of docs are
  // "pulsed" (inlined):
  PostingsWriterBase pulsingWriter = null;

  // Terms dict
  boolean success = false;
  try {
    docsWriter = wrappedPostingsBaseFormat.postingsWriterBase(state);

    // Terms that have <= freqCutoff number of docs are
    // "pulsed" (inlined):
    pulsingWriter = new PulsingPostingsWriter(state, freqCutoff, docsWriter);
    FieldsConsumer ret = new BlockTreeTermsWriter(state, pulsingWriter, minBlockSize, maxBlockSize);
    success = true;
    return ret;
  } finally {
    if (!success) {
      IOUtils.closeWhileHandlingException(docsWriter, pulsingWriter);
    }
  }
}
 
开发者ID:europeana,项目名称:search,代码行数:26,代码来源:PulsingPostingsFormat.java

示例7: fieldsConsumer

import org.apache.lucene.codecs.PostingsWriterBase; //导入依赖的package包/类
@Override
public FieldsConsumer fieldsConsumer(SegmentWriteState state) throws IOException {
  PostingsWriterBase postingsWriter = new IDVersionPostingsWriter(state);
  boolean success = false;
  try {
    FieldsConsumer ret = new VersionBlockTreeTermsWriter(state, 
                                                         postingsWriter,
                                                         minTermsInBlock, 
                                                         maxTermsInBlock);
    success = true;
    return ret;
  } finally {
    if (!success) {
      IOUtils.closeWhileHandlingException(postingsWriter);
    }
  }
}
 
开发者ID:europeana,项目名称:search,代码行数:18,代码来源:IDVersionPostingsFormat.java

示例8: fieldsConsumer

import org.apache.lucene.codecs.PostingsWriterBase; //导入依赖的package包/类
@Override
public FieldsConsumer fieldsConsumer(SegmentWriteState state) throws IOException {
  if (!LuceneTestCase.OLD_FORMAT_IMPERSONATION_IS_ACTIVE) {
    return super.fieldsConsumer(state);
  } else {
    PostingsWriterBase docs = new Lucene40PostingsWriter(state);
    
    // TODO: should we make the terms index more easily
    // pluggable?  Ie so that this codec would record which
    // index impl was used, and switch on loading?
    // Or... you must make a new Codec for this?
    boolean success = false;
    try {
      FieldsConsumer ret = new BlockTreeTermsWriter(state, docs, minBlockSize, maxBlockSize);
      success = true;
      return ret;
    } finally {
      if (!success) {
        docs.close();
      }
    }
  }
}
 
开发者ID:europeana,项目名称:search,代码行数:24,代码来源:Lucene40RWPostingsFormat.java

示例9: BlockTermsWriter

import org.apache.lucene.codecs.PostingsWriterBase; //导入依赖的package包/类
public BlockTermsWriter(TermsIndexWriterBase termsIndexWriter,
    SegmentWriteState state, PostingsWriterBase postingsWriter)
    throws IOException {
  final String termsFileName = IndexFileNames.segmentFileName(state.segmentInfo.name, state.segmentSuffix, TERMS_EXTENSION);
  this.termsIndexWriter = termsIndexWriter;
  out = state.directory.createOutput(termsFileName, state.context);
  boolean success = false;
  try {
    fieldInfos = state.fieldInfos;
    writeHeader(out);
    currentField = null;
    this.postingsWriter = postingsWriter;
    // segment = state.segmentName;
    
    //System.out.println("BTW.init seg=" + state.segmentName);
    
    postingsWriter.start(out); // have consumer write its format/header
    success = true;
  } finally {
    if (!success) {
      IOUtils.closeWhileHandlingException(out);
    }
  }
}
 
开发者ID:pkarmstr,项目名称:NYBC,代码行数:25,代码来源:BlockTermsWriter.java

示例10: fieldsConsumer

import org.apache.lucene.codecs.PostingsWriterBase; //导入依赖的package包/类
@Override
public FieldsConsumer fieldsConsumer(SegmentWriteState state) throws IOException {
  PostingsWriterBase docsWriter = null;

  // Terms that have <= freqCutoff number of docs are
  // "pulsed" (inlined):
  PostingsWriterBase pulsingWriter = null;

  // Terms dict
  boolean success = false;
  try {
    docsWriter = wrappedPostingsBaseFormat.postingsWriterBase(state);

    // Terms that have <= freqCutoff number of docs are
    // "pulsed" (inlined):
    pulsingWriter = new PulsingPostingsWriter(freqCutoff, docsWriter);
    FieldsConsumer ret = new BlockTreeTermsWriter(state, pulsingWriter, minBlockSize, maxBlockSize);
    success = true;
    return ret;
  } finally {
    if (!success) {
      IOUtils.closeWhileHandlingException(docsWriter, pulsingWriter);
    }
  }
}
 
开发者ID:pkarmstr,项目名称:NYBC,代码行数:26,代码来源:PulsingPostingsFormat.java

示例11: fieldsConsumer

import org.apache.lucene.codecs.PostingsWriterBase; //导入依赖的package包/类
@Override
public FieldsConsumer fieldsConsumer(SegmentWriteState state) throws IOException {
  PostingsWriterBase docs = new Lucene40PostingsWriter(state);

  // TODO: should we make the terms index more easily
  // pluggable?  Ie so that this codec would record which
  // index impl was used, and switch on loading?
  // Or... you must make a new Codec for this?
  boolean success = false;
  try {
    FieldsConsumer ret = new BlockTreeTermsWriter(state, docs, minBlockSize, maxBlockSize);
    success = true;
    return ret;
  } finally {
    if (!success) {
      docs.close();
    }
  }
}
 
开发者ID:pkarmstr,项目名称:NYBC,代码行数:20,代码来源:Lucene40RWPostingsFormat.java

示例12: fieldsConsumer

import org.apache.lucene.codecs.PostingsWriterBase; //导入依赖的package包/类
@Override
public FieldsConsumer fieldsConsumer(SegmentWriteState state) throws IOException {
  PostingsWriterBase postingsWriter = new Lucene41PostingsWriter(state);

  boolean success = false;
  try {
    FieldsConsumer ret = new FSTOrdTermsWriter(state, postingsWriter);
    success = true;
    return ret;
  } finally {
    if (!success) {
      IOUtils.closeWhileHandlingException(postingsWriter);
    }
  }
}
 
开发者ID:europeana,项目名称:search,代码行数:16,代码来源:FSTOrdPostingsFormat.java

示例13: fieldsConsumer

import org.apache.lucene.codecs.PostingsWriterBase; //导入依赖的package包/类
@Override
public FieldsConsumer fieldsConsumer(SegmentWriteState state) throws IOException {
  PostingsWriterBase postingsWriter = new Lucene41PostingsWriter(state);

  boolean success = false;
  try {
    FieldsConsumer ret = new FSTTermsWriter(state, postingsWriter);
    success = true;
    return ret;
  } finally {
    if (!success) {
      IOUtils.closeWhileHandlingException(postingsWriter);
    }
  }
}
 
开发者ID:europeana,项目名称:search,代码行数:16,代码来源:FSTPostingsFormat.java

示例14: TermsWriter

import org.apache.lucene.codecs.PostingsWriterBase; //导入依赖的package包/类
TermsWriter(
    TermsIndexWriterBase.FieldWriter fieldIndexWriter,
    FieldInfo fieldInfo,
    PostingsWriterBase postingsWriter) 
{
  this.fieldInfo = fieldInfo;
  this.fieldIndexWriter = fieldIndexWriter;
  pendingTerms = new TermEntry[32];
  for(int i=0;i<pendingTerms.length;i++) {
    pendingTerms[i] = new TermEntry();
  }
  termsStartPointer = out.getFilePointer();
  this.postingsWriter = postingsWriter;
  this.longsSize = postingsWriter.setField(fieldInfo);
}
 
开发者ID:europeana,项目名称:search,代码行数:16,代码来源:BlockTermsWriter.java

示例15: PulsingPostingsWriter

import org.apache.lucene.codecs.PostingsWriterBase; //导入依赖的package包/类
/** If the total number of positions (summed across all docs
 *  for this term) is <= maxPositions, then the postings are
 *  inlined into terms dict */
public PulsingPostingsWriter(SegmentWriteState state, int maxPositions, PostingsWriterBase wrappedPostingsWriter) {

  pending = new Position[maxPositions];
  for(int i=0;i<maxPositions;i++) {
    pending[i] = new Position();
  }
  fields = new ArrayList<>();

  // We simply wrap another postings writer, but only call
  // on it when tot positions is >= the cutoff:
  this.wrappedPostingsWriter = wrappedPostingsWriter;
  this.segmentState = state;
}
 
开发者ID:europeana,项目名称:search,代码行数:17,代码来源:PulsingPostingsWriter.java


注:本文中的org.apache.lucene.codecs.PostingsWriterBase类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。