• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java SegmentReadState类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: fieldsProducer

import org.apache.lucene.index.SegmentReadState; //导入依赖的package包/类
@Override
public FieldsProducer fieldsProducer(SegmentReadState state) throws IOException {
  PostingsReaderBase postings = new Lucene40PostingsReader(state.directory, state.fieldInfos, state.segmentInfo, state.context, state.segmentSuffix);

  boolean success = false;
  try {
    FieldsProducer ret = new BlockTreeTermsReader(
                                                  state.directory,
                                                  state.fieldInfos,
                                                  state.segmentInfo,
                                                  postings,
                                                  state.context,
                                                  state.segmentSuffix,
                                                  state.termsIndexDivisor);
    success = true;
    return ret;
  } finally {
    if (!success) {
      postings.close();
    }
  }
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:23,代码来源:Lucene40PostingsFormat.java


示例2: fieldsProducer

import org.apache.lucene.index.SegmentReadState; //导入依赖的package包/类
@Override
public FieldsProducer fieldsProducer(SegmentReadState state) throws IOException {
  PostingsReaderBase postingsReader = new Lucene41PostingsReader(state.directory,
                                                              state.fieldInfos,
                                                              state.segmentInfo,
                                                              state.context,
                                                              state.segmentSuffix);
  boolean success = false;
  try {
    FieldsProducer ret = new BlockTreeTermsReader(state.directory,
                                                  state.fieldInfos,
                                                  state.segmentInfo,
                                                  postingsReader,
                                                  state.context,
                                                  state.segmentSuffix,
                                                  state.termsIndexDivisor);
    success = true;
    return ret;
  } finally {
    if (!success) {
      IOUtils.closeWhileHandlingException(postingsReader);
    }
  }
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:25,代码来源:Lucene41PostingsFormat.java


示例3: fieldsProducer

import org.apache.lucene.index.SegmentReadState; //导入依赖的package包/类
@Override
public FieldsProducer fieldsProducer(SegmentReadState state) throws IOException {
  PostingsReaderBase postings = new Lucene40PostingsReader(state.directory, state.fieldInfos, state.segmentInfo, state.context, state.segmentSuffix);
  
  boolean success = false;
  try {
    FieldsProducer ret = new AppendingTermsReader(
                                                  state.directory,
                                                  state.fieldInfos,
                                                  state.segmentInfo,
                                                  postings,
                                                  state.context,
                                                  state.segmentSuffix,
                                                  state.termsIndexDivisor);
    success = true;
    return ret;
  } finally {
    if (!success) {
      postings.close();
    }
  }
}
 
开发者ID:europeana,项目名称:search,代码行数:23,代码来源:AppendingPostingsFormat.java


示例4: fieldsProducer

import org.apache.lucene.index.SegmentReadState; //导入依赖的package包/类
@Override
public FieldsProducer fieldsProducer(SegmentReadState state) throws IOException {
  FieldsProducer postings = PostingsFormat.forName("Lucene41").fieldsProducer(state);
  if (state.context.context != IOContext.Context.MERGE) {
    FieldsProducer loadedPostings;
    try {
      postings.checkIntegrity();
      loadedPostings = new DirectFields(state, postings, minSkipCount, lowFreqCutoff);
    } finally {
      postings.close();
    }
    return loadedPostings;
  } else {
    // Don't load postings for merge:
    return postings;
  }
}
 
开发者ID:europeana,项目名称:search,代码行数:18,代码来源:DirectPostingsFormat.java


示例5: fieldsProducer

import org.apache.lucene.index.SegmentReadState; //导入依赖的package包/类
@Override
public FieldsProducer fieldsProducer(SegmentReadState state) throws IOException {
  PostingsReaderBase postingsReader = new Lucene41PostingsReader(state.directory,
                                                              state.fieldInfos,
                                                              state.segmentInfo,
                                                              state.context,
                                                              state.segmentSuffix);
  boolean success = false;
  try {
    FieldsProducer ret = new FSTOrdTermsReader(state, postingsReader);
    success = true;
    return ret;
  } finally {
    if (!success) {
      IOUtils.closeWhileHandlingException(postingsReader);
    }
  }
}
 
开发者ID:europeana,项目名称:search,代码行数:19,代码来源:FSTOrdPostingsFormat.java


示例6: fieldsProducer

import org.apache.lucene.index.SegmentReadState; //导入依赖的package包/类
@Override
public FieldsProducer fieldsProducer(SegmentReadState state) throws IOException {
  PostingsReaderBase postingsReader = new Lucene41PostingsReader(state.directory,
                                                              state.fieldInfos,
                                                              state.segmentInfo,
                                                              state.context,
                                                              state.segmentSuffix);
  boolean success = false;
  try {
    FieldsProducer ret = new FSTTermsReader(state, postingsReader);
    success = true;
    return ret;
  } finally {
    if (!success) {
      IOUtils.closeWhileHandlingException(postingsReader);
    }
  }
}
 
开发者ID:europeana,项目名称:search,代码行数:19,代码来源:FSTPostingsFormat.java


示例7: fieldsProducer

import org.apache.lucene.index.SegmentReadState; //导入依赖的package包/类
@Override
public FieldsProducer fieldsProducer(SegmentReadState state) throws IOException {
  PostingsReaderBase postingsReader = new Lucene41PostingsReader(state.directory,
                                                                 state.fieldInfos,
                                                                 state.segmentInfo,
                                                                 state.context,
                                                                 state.segmentSuffix);
  boolean success = false;
  try {
    FieldsProducer ret = new OrdsBlockTreeTermsReader(state.directory,
                                                      state.fieldInfos,
                                                      state.segmentInfo,
                                                      postingsReader,
                                                      state.context,
                                                      state.segmentSuffix);
    success = true;
    return ret;
  } finally {
    if (!success) {
      IOUtils.closeWhileHandlingException(postingsReader);
    }
  }
}
 
开发者ID:europeana,项目名称:search,代码行数:24,代码来源:Ords41PostingsFormat.java


示例8: fieldsProducer

import org.apache.lucene.index.SegmentReadState; //导入依赖的package包/类
@Override
public FieldsProducer fieldsProducer(SegmentReadState state) throws IOException {
  PostingsReaderBase docsReader = null;
  PostingsReaderBase pulsingReader = null;

  boolean success = false;
  try {
    docsReader = wrappedPostingsBaseFormat.postingsReaderBase(state);
    pulsingReader = new PulsingPostingsReader(state, docsReader);
    FieldsProducer ret = new BlockTreeTermsReader(
                                                  state.directory, state.fieldInfos, state.segmentInfo,
                                                  pulsingReader,
                                                  state.context,
                                                  state.segmentSuffix,
                                                  state.termsIndexDivisor);
    success = true;
    return ret;
  } finally {
    if (!success) {
      IOUtils.closeWhileHandlingException(docsReader, pulsingReader);
    }
  }
}
 
开发者ID:europeana,项目名称:search,代码行数:24,代码来源:PulsingPostingsFormat.java


示例9: fieldsProducer

import org.apache.lucene.index.SegmentReadState; //导入依赖的package包/类
@Override
public FieldsProducer fieldsProducer(SegmentReadState state) throws IOException {
  PostingsReaderBase postingsReader = new IDVersionPostingsReader();
  boolean success = false;
   try {
     FieldsProducer ret = new VersionBlockTreeTermsReader(state.directory,
                                                          state.fieldInfos,
                                                          state.segmentInfo,
                                                          postingsReader,
                                                          state.context,
                                                          state.segmentSuffix);
     success = true;
     return ret;
   } finally {
     if (!success) {
       IOUtils.closeWhileHandlingException(postingsReader);
     }
   }
}
 
开发者ID:europeana,项目名称:search,代码行数:20,代码来源:IDVersionPostingsFormat.java


示例10: fieldsProducer

import org.apache.lucene.index.SegmentReadState; //导入依赖的package包/类
@Override
public FieldsProducer fieldsProducer(SegmentReadState readState)
  throws IOException {

  // Load our ID:
  final String idFileName = IndexFileNames.segmentFileName(readState.segmentInfo.name, readState.segmentSuffix, ID_EXTENSION);
  IndexInput in = readState.directory.openInput(idFileName, readState.context);
  boolean success = false;
  final int id;
  try {
    CodecUtil.checkHeader(in, RAM_ONLY_NAME, VERSION_START, VERSION_LATEST);
    id = in.readVInt();
    success = true;
  } finally {
    if (!success) {
      IOUtils.closeWhileHandlingException(in);
    } else {
      IOUtils.close(in);
    }
  }
  
  synchronized(state) {
    return state.get(id);
  }
}
 
开发者ID:europeana,项目名称:search,代码行数:26,代码来源:RAMOnlyPostingsFormat.java


示例11: fieldsProducer

import org.apache.lucene.index.SegmentReadState; //导入依赖的package包/类
@Override
public FieldsProducer fieldsProducer(SegmentReadState state) throws IOException {
  FieldsProducer postings = PostingsFormat.forName("Lucene41").fieldsProducer(state);
  if (state.context.context != IOContext.Context.MERGE) {
    FieldsProducer loadedPostings;
    try {
      loadedPostings = new DirectFields(state, postings, minSkipCount, lowFreqCutoff);
    } finally {
      postings.close();
    }
    return loadedPostings;
  } else {
    // Don't load postings for merge:
    return postings;
  }
}
 
开发者ID:pkarmstr,项目名称:NYBC,代码行数:17,代码来源:DirectPostingsFormat.java


示例12: normsProducer

import org.apache.lucene.index.SegmentReadState; //导入依赖的package包/类
@Override
public DocValuesProducer normsProducer(SegmentReadState state) throws IOException {
  String filename = IndexFileNames.segmentFileName(state.segmentInfo.name, 
                                                   "nrm", 
                                                   IndexFileNames.COMPOUND_FILE_EXTENSION);
  return new Lucene40DocValuesReader(state, filename, Lucene40FieldInfosReader.LEGACY_NORM_TYPE_KEY);
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:8,代码来源:Lucene40NormsFormat.java


示例13: fieldsProducer

import org.apache.lucene.index.SegmentReadState; //导入依赖的package包/类
@Override
public DocValuesProducer fieldsProducer(SegmentReadState state) throws IOException {
  String filename = IndexFileNames.segmentFileName(state.segmentInfo.name, 
                                                   "dv", 
                                                   IndexFileNames.COMPOUND_FILE_EXTENSION);
  return new Lucene40DocValuesReader(state, filename, Lucene40FieldInfosReader.LEGACY_DV_TYPE_KEY);
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:8,代码来源:Lucene40DocValuesFormat.java


示例14: FieldsReader

import org.apache.lucene.index.SegmentReadState; //导入依赖的package包/类
public FieldsReader(final SegmentReadState readState) throws IOException {

      // Read _X.per and init each format:
      boolean success = false;
      try {
        // Read field name -> format name
        for (FieldInfo fi : readState.fieldInfos) {
          if (fi.isIndexed()) {
            final String fieldName = fi.name;
            final String formatName = fi.getAttribute(PER_FIELD_FORMAT_KEY);
            if (formatName != null) {
              // null formatName means the field is in fieldInfos, but has no postings!
              final String suffix = fi.getAttribute(PER_FIELD_SUFFIX_KEY);
              assert suffix != null;
              PostingsFormat format = PostingsFormat.forName(formatName);
              String segmentSuffix = getSuffix(formatName, suffix);
              if (!formats.containsKey(segmentSuffix)) {
                formats.put(segmentSuffix, format.fieldsProducer(new SegmentReadState(readState, segmentSuffix)));
              }
              fields.put(fieldName, formats.get(segmentSuffix));
            }
          }
        }
        success = true;
      } finally {
        if (!success) {
          IOUtils.closeWhileHandlingException(formats.values());
        }
      }
    }
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:31,代码来源:PerFieldPostingsFormat.java


示例15: FieldsReader

import org.apache.lucene.index.SegmentReadState; //导入依赖的package包/类
public FieldsReader(final SegmentReadState readState) throws IOException {

      // Init each unique format:
      boolean success = false;
      try {
        // Read field name -> format name
        for (FieldInfo fi : readState.fieldInfos) {
          if (fi.hasDocValues()) {
            final String fieldName = fi.name;
            final String formatName = fi.getAttribute(PER_FIELD_FORMAT_KEY);
            if (formatName != null) {
              // null formatName means the field is in fieldInfos, but has no docvalues!
              final String suffix = fi.getAttribute(PER_FIELD_SUFFIX_KEY);
              assert suffix != null;
              DocValuesFormat format = DocValuesFormat.forName(formatName);
              String segmentSuffix = getFullSegmentSuffix(readState.segmentSuffix, getSuffix(formatName, suffix));
              if (!formats.containsKey(segmentSuffix)) {
                formats.put(segmentSuffix, format.fieldsProducer(new SegmentReadState(readState, segmentSuffix)));
              }
              fields.put(fieldName, formats.get(segmentSuffix));
            }
          }
        }
        success = true;
      } finally {
        if (!success) {
          IOUtils.closeWhileHandlingException(formats.values());
        }
      }
    }
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:31,代码来源:PerFieldDocValuesFormat.java


示例16: CompletionFieldsProducer

import org.apache.lucene.index.SegmentReadState; //导入依赖的package包/类
public CompletionFieldsProducer(SegmentReadState state) throws IOException {
    String suggestFSTFile = IndexFileNames.segmentFileName(state.segmentInfo.name, state.segmentSuffix, EXTENSION);
    IndexInput input = state.directory.openInput(suggestFSTFile, state.context);
    version = CodecUtil.checkHeader(input, CODEC_NAME, SUGGEST_CODEC_VERSION, SUGGEST_VERSION_CURRENT);
    FieldsProducer delegateProducer = null;
    boolean success = false;
    try {
        PostingsFormat delegatePostingsFormat = PostingsFormat.forName(input.readString());
        String providerName = input.readString();
        CompletionLookupProvider completionLookupProvider = providers.get(providerName);
        if (completionLookupProvider == null) {
            throw new IllegalStateException("no provider with name [" + providerName + "] registered");
        }
        // TODO: we could clone the ReadState and make it always forward IOContext.MERGE to prevent unecessary heap usage?
        delegateProducer = delegatePostingsFormat.fieldsProducer(state);
        /*
         * If we are merging we don't load the FSTs at all such that we
         * don't consume so much memory during merge
         */
        if (state.context.context != Context.MERGE) {
            // TODO: maybe we can do this in a fully lazy fashion based on some configuration
            // eventually we should have some kind of curciut breaker that prevents us from going OOM here
            // with some configuration
            this.lookupFactory = completionLookupProvider.load(input);
        } else {
            this.lookupFactory = null;
        }
        this.delegateProducer = delegateProducer;
        success = true;
    } finally {
        if (!success) {
            IOUtils.closeWhileHandlingException(delegateProducer, input);
        } else {
            IOUtils.close(input);
        }
    }
}
 
开发者ID:baidu,项目名称:Elasticsearch,代码行数:38,代码来源:Completion090PostingsFormat.java


示例17: FSTTermsReader

import org.apache.lucene.index.SegmentReadState; //导入依赖的package包/类
public FSTTermsReader(SegmentReadState state, PostingsReaderBase postingsReader) throws IOException {
  final String termsFileName = IndexFileNames.segmentFileName(state.segmentInfo.name, state.segmentSuffix, FSTTermsWriter.TERMS_EXTENSION);

  this.postingsReader = postingsReader;
  final IndexInput in = state.directory.openInput(termsFileName, state.context);

  boolean success = false;
  try {
    version = readHeader(in);
    if (version >= FSTTermsWriter.TERMS_VERSION_CHECKSUM) {
      CodecUtil.checksumEntireFile(in);
    }
    this.postingsReader.init(in);
    seekDir(in);

    final FieldInfos fieldInfos = state.fieldInfos;
    final int numFields = in.readVInt();
    for (int i = 0; i < numFields; i++) {
      int fieldNumber = in.readVInt();
      FieldInfo fieldInfo = fieldInfos.fieldInfo(fieldNumber);
      long numTerms = in.readVLong();
      long sumTotalTermFreq = fieldInfo.getIndexOptions() == IndexOptions.DOCS_ONLY ? -1 : in.readVLong();
      long sumDocFreq = in.readVLong();
      int docCount = in.readVInt();
      int longsSize = in.readVInt();
      TermsReader current = new TermsReader(fieldInfo, in, numTerms, sumTotalTermFreq, sumDocFreq, docCount, longsSize);
      TermsReader previous = fields.put(fieldInfo.name, current);
      checkFieldSummary(state.segmentInfo, in, current, previous);
    }
    success = true;
  } finally {
    if (success) {
      IOUtils.close(in);
    } else {
      IOUtils.closeWhileHandlingException(in);
    }
  }
}
 
开发者ID:europeana,项目名称:search,代码行数:39,代码来源:FSTTermsReader.java


示例18: SimpleTextFieldsReader

import org.apache.lucene.index.SegmentReadState; //导入依赖的package包/类
public SimpleTextFieldsReader(SegmentReadState state) throws IOException {
  this.maxDoc = state.segmentInfo.getDocCount();
  fieldInfos = state.fieldInfos;
  in = state.directory.openInput(SimpleTextPostingsFormat.getPostingsFileName(state.segmentInfo.name, state.segmentSuffix), state.context);
  boolean success = false;
  try {
    fields = readFields(in.clone());
    success = true;
  } finally {
    if (!success) {
      IOUtils.closeWhileHandlingException(this);
    }
  }
}
 
开发者ID:europeana,项目名称:search,代码行数:15,代码来源:SimpleTextFieldsReader.java


示例19: BloomFilteredFieldsProducer

import org.apache.lucene.index.SegmentReadState; //导入依赖的package包/类
public BloomFilteredFieldsProducer(SegmentReadState state)
    throws IOException {
  
  String bloomFileName = IndexFileNames.segmentFileName(
      state.segmentInfo.name, state.segmentSuffix, BLOOM_EXTENSION);
  ChecksumIndexInput bloomIn = null;
  boolean success = false;
  try {
    bloomIn = state.directory.openChecksumInput(bloomFileName, state.context);
    int version = CodecUtil.checkHeader(bloomIn, BLOOM_CODEC_NAME, VERSION_START, VERSION_CURRENT);
    // // Load the hash function used in the BloomFilter
    // hashFunction = HashFunction.forName(bloomIn.readString());
    // Load the delegate postings format
    PostingsFormat delegatePostingsFormat = PostingsFormat.forName(bloomIn
        .readString());
    
    this.delegateFieldsProducer = delegatePostingsFormat
        .fieldsProducer(state);
    int numBlooms = bloomIn.readInt();
    for (int i = 0; i < numBlooms; i++) {
      int fieldNum = bloomIn.readInt();
      FuzzySet bloom = FuzzySet.deserialize(bloomIn);
      FieldInfo fieldInfo = state.fieldInfos.fieldInfo(fieldNum);
      bloomsByFieldName.put(fieldInfo.name, bloom);
    }
    if (version >= VERSION_CHECKSUM) {
      CodecUtil.checkFooter(bloomIn);
    } else {
      CodecUtil.checkEOF(bloomIn);
    }
    IOUtils.close(bloomIn);
    success = true;
  } finally {
    if (!success) {
      IOUtils.closeWhileHandlingException(bloomIn, delegateFieldsProducer);
    }
  }
}
 
开发者ID:europeana,项目名称:search,代码行数:39,代码来源:BloomFilteringPostingsFormat.java


示例20: normsProducer

import org.apache.lucene.index.SegmentReadState; //导入依赖的package包/类
@Override
public DocValuesProducer normsProducer(SegmentReadState state) throws IOException {
  assert state.fieldInfos.hasNorms();
  DocValuesProducer producer = in.normsProducer(state);
  assert producer != null;
  return new AssertingDocValuesProducer(producer, state.segmentInfo.getDocCount());
}
 
开发者ID:europeana,项目名称:search,代码行数:8,代码来源:AssertingNormsFormat.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java INEIGuiHandler类代码示例发布时间:2022-05-23
下一篇:
Java MouseButtonControl类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap