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

Java FieldsProducer类代码示例

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

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



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

示例1: fieldsProducer

import org.apache.lucene.codecs.FieldsProducer; //导入依赖的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.codecs.FieldsProducer; //导入依赖的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.codecs.FieldsProducer; //导入依赖的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.codecs.FieldsProducer; //导入依赖的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.codecs.FieldsProducer; //导入依赖的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.codecs.FieldsProducer; //导入依赖的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.codecs.FieldsProducer; //导入依赖的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.codecs.FieldsProducer; //导入依赖的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.codecs.FieldsProducer; //导入依赖的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.codecs.FieldsProducer; //导入依赖的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: testFull

import org.apache.lucene.codecs.FieldsProducer; //导入依赖的package包/类
/** Indexes all fields/terms at the specified
 *  IndexOptions, and fully tests at that IndexOptions. */
private void testFull(IndexOptions options, boolean withPayloads) throws Exception {
  File path = createTempDir("testPostingsFormat.testExact");
  Directory dir = newFSDirectory(path);

  // TODO test thread safety of buildIndex too
  FieldsProducer fieldsProducer = buildIndex(dir, options, withPayloads, true);

  testFields(fieldsProducer);

  IndexOptions[] allOptions = IndexOptions.values();
  int maxIndexOption = Arrays.asList(allOptions).indexOf(options);

  for(int i=0;i<=maxIndexOption;i++) {
    testTerms(fieldsProducer, EnumSet.allOf(Option.class), allOptions[i], options, true);
    if (withPayloads) {
      // If we indexed w/ payloads, also test enums w/o accessing payloads:
      testTerms(fieldsProducer, EnumSet.complementOf(EnumSet.of(Option.PAYLOADS)), allOptions[i], options, true);
    }
  }

  fieldsProducer.close();
  dir.close();
  TestUtil.rm(path);
}
 
开发者ID:europeana,项目名称:search,代码行数:27,代码来源:BasePostingsFormatTestCase.java


示例12: testRandom

import org.apache.lucene.codecs.FieldsProducer; //导入依赖的package包/类
public void testRandom() throws Exception {

    int iters = 5;

    for(int iter=0;iter<iters;iter++) {
      File path = createTempDir("testPostingsFormat");
      Directory dir = newFSDirectory(path);

      boolean indexPayloads = random().nextBoolean();
      // TODO test thread safety of buildIndex too
      FieldsProducer fieldsProducer = buildIndex(dir, IndexOptions.DOCS_AND_FREQS_AND_POSITIONS_AND_OFFSETS, indexPayloads, false);

      testFields(fieldsProducer);

      // NOTE: you can also test "weaker" index options than
      // you indexed with:
      testTerms(fieldsProducer, EnumSet.allOf(Option.class), IndexOptions.DOCS_AND_FREQS_AND_POSITIONS_AND_OFFSETS, IndexOptions.DOCS_AND_FREQS_AND_POSITIONS_AND_OFFSETS, false);

      fieldsProducer.close();
      fieldsProducer = null;

      dir.close();
      TestUtil.rm(path);
    }
  }
 
开发者ID:europeana,项目名称:search,代码行数:26,代码来源:BasePostingsFormatTestCase.java


示例13: fieldsProducer

import org.apache.lucene.codecs.FieldsProducer; //导入依赖的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


示例14: fieldsProducer

import org.apache.lucene.codecs.FieldsProducer; //导入依赖的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(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:pkarmstr,项目名称:NYBC,代码行数:24,代码来源:PulsingPostingsFormat.java


示例15: testFull

import org.apache.lucene.codecs.FieldsProducer; //导入依赖的package包/类
/** Indexes all fields/terms at the specified
 *  IndexOptions, and fully tests at that IndexOptions. */
private void testFull(IndexOptions options, boolean withPayloads) throws Exception {
  File path = _TestUtil.getTempDir("testPostingsFormat.testExact");
  Directory dir = newFSDirectory(path);

  // TODO test thread safety of buildIndex too
  FieldsProducer fieldsProducer = buildIndex(dir, options, withPayloads, true);

  testFields(fieldsProducer);

  IndexOptions[] allOptions = IndexOptions.values();
  int maxIndexOption = Arrays.asList(allOptions).indexOf(options);

  for(int i=0;i<=maxIndexOption;i++) {
    testTerms(fieldsProducer, EnumSet.allOf(Option.class), allOptions[i], options, true);
    if (withPayloads) {
      // If we indexed w/ payloads, also test enums w/o accessing payloads:
      testTerms(fieldsProducer, EnumSet.complementOf(EnumSet.of(Option.PAYLOADS)), allOptions[i], options, true);
    }
  }

  fieldsProducer.close();
  dir.close();
  _TestUtil.rmDir(path);
}
 
开发者ID:pkarmstr,项目名称:NYBC,代码行数:27,代码来源:BasePostingsFormatTestCase.java


示例16: testRandom

import org.apache.lucene.codecs.FieldsProducer; //导入依赖的package包/类
public void testRandom() throws Exception {

    int iters = 5;

    for(int iter=0;iter<iters;iter++) {
      File path = _TestUtil.getTempDir("testPostingsFormat");
      Directory dir = newFSDirectory(path);

      boolean indexPayloads = random().nextBoolean();
      // TODO test thread safety of buildIndex too
      FieldsProducer fieldsProducer = buildIndex(dir, IndexOptions.DOCS_AND_FREQS_AND_POSITIONS_AND_OFFSETS, indexPayloads, false);

      testFields(fieldsProducer);

      // NOTE: you can also test "weaker" index options than
      // you indexed with:
      testTerms(fieldsProducer, EnumSet.allOf(Option.class), IndexOptions.DOCS_AND_FREQS_AND_POSITIONS_AND_OFFSETS, IndexOptions.DOCS_AND_FREQS_AND_POSITIONS_AND_OFFSETS, false);

      fieldsProducer.close();
      fieldsProducer = null;

      dir.close();
      _TestUtil.rmDir(path);
    }
  }
 
开发者ID:pkarmstr,项目名称:NYBC,代码行数:26,代码来源:BasePostingsFormatTestCase.java



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
Java ExternalMetadataReader类代码示例发布时间:2022-05-23
下一篇:
Java CacheableDeserializerIdManager类代码示例发布时间: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