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

Java Lucene42Codec类代码示例

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

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



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

示例1: test

import org.apache.lucene.codecs.lucene42.Lucene42Codec; //导入依赖的package包/类
public void test() throws Exception {
  Directory dir = newDirectory();
  IndexWriterConfig conf = newIndexWriterConfig(TEST_VERSION_CURRENT, new MockAnalyzer(random()));
  conf.setCodec(new Lucene42Codec());
  // riw should sometimes create docvalues fields, etc
  RandomIndexWriter riw = new RandomIndexWriter(random(), dir, conf);
  Document doc = new Document();
  // these fields should sometimes get term vectors, etc
  Field idField = newStringField("id", "", Field.Store.NO);
  Field bodyField = newTextField("body", "", Field.Store.NO);
  doc.add(idField);
  doc.add(bodyField);
  for (int i = 0; i < 100; i++) {
    idField.setStringValue(Integer.toString(i));
    bodyField.setStringValue(_TestUtil.randomUnicodeString(random()));
    riw.addDocument(doc);
    if (random().nextInt(7) == 0) {
      riw.commit();
    }
  }
  riw.close();
  checkHeaders(dir);
  dir.close();
}
 
开发者ID:pkarmstr,项目名称:NYBC,代码行数:25,代码来源:TestAllFilesHaveCodecHeader.java


示例2: alwaysPostingsFormat

import org.apache.lucene.codecs.lucene42.Lucene42Codec; //导入依赖的package包/类
/** Return a Codec that can read any of the
 *  default codecs and formats, but always writes in the specified
 *  format. */
public static Codec alwaysPostingsFormat(final PostingsFormat format) {
  // TODO: we really need for postings impls etc to announce themselves
  // (and maybe their params, too) to infostream on flush and merge.
  // otherwise in a real debugging situation we won't know whats going on!
  if (LuceneTestCase.VERBOSE) {
    System.out.println("forcing postings format to:" + format);
  }
  return new Lucene42Codec() {
    @Override
    public PostingsFormat getPostingsFormatForField(String field) {
      return format;
    }
  };
}
 
开发者ID:pkarmstr,项目名称:NYBC,代码行数:18,代码来源:_TestUtil.java


示例3: alwaysDocValuesFormat

import org.apache.lucene.codecs.lucene42.Lucene42Codec; //导入依赖的package包/类
/** Return a Codec that can read any of the
 *  default codecs and formats, but always writes in the specified
 *  format. */
public static Codec alwaysDocValuesFormat(final DocValuesFormat format) {
  // TODO: we really need for docvalues impls etc to announce themselves
  // (and maybe their params, too) to infostream on flush and merge.
  // otherwise in a real debugging situation we won't know whats going on!
  if (LuceneTestCase.VERBOSE) {
    System.out.println("forcing docvalues format to:" + format);
  }
  return new Lucene42Codec() {
    @Override
    public DocValuesFormat getDocValuesFormatForField(String field) {
      return format;
    }
  };
}
 
开发者ID:pkarmstr,项目名称:NYBC,代码行数:18,代码来源:_TestUtil.java


示例4: testSameCodecDifferentInstance

import org.apache.lucene.codecs.lucene42.Lucene42Codec; //导入依赖的package包/类
public void testSameCodecDifferentInstance() throws Exception {
  Codec codec = new Lucene42Codec() {
    @Override
    public PostingsFormat getPostingsFormatForField(String field) {
      if ("id".equals(field)) {
        return new Pulsing41PostingsFormat(1);
      } else if ("date".equals(field)) {
        return new Pulsing41PostingsFormat(1);
      } else {
        return super.getPostingsFormatForField(field);
      }
    }
  };
  doTestMixedPostings(codec);
}
 
开发者ID:pkarmstr,项目名称:NYBC,代码行数:16,代码来源:TestPerFieldPostingsFormat2.java


示例5: testSameCodecDifferentParams

import org.apache.lucene.codecs.lucene42.Lucene42Codec; //导入依赖的package包/类
public void testSameCodecDifferentParams() throws Exception {
  Codec codec = new Lucene42Codec() {
    @Override
    public PostingsFormat getPostingsFormatForField(String field) {
      if ("id".equals(field)) {
        return new Pulsing41PostingsFormat(1);
      } else if ("date".equals(field)) {
        return new Pulsing41PostingsFormat(2);
      } else {
        return super.getPostingsFormatForField(field);
      }
    }
  };
  doTestMixedPostings(codec);
}
 
开发者ID:pkarmstr,项目名称:NYBC,代码行数:16,代码来源:TestPerFieldPostingsFormat2.java


示例6: LireCustomCodec

import org.apache.lucene.codecs.lucene42.Lucene42Codec; //导入依赖的package包/类
public LireCustomCodec() {
    super("LireCustomCodec", new Lucene42Codec());
}
 
开发者ID:fish2000,项目名称:lire,代码行数:4,代码来源:LireCustomCodec.java


示例7: AssertingCodec

import org.apache.lucene.codecs.lucene42.Lucene42Codec; //导入依赖的package包/类
public AssertingCodec() {
  super("Asserting", new Lucene42Codec());
}
 
开发者ID:pkarmstr,项目名称:NYBC,代码行数:4,代码来源:AssertingCodec.java


示例8: CheapBastardCodec

import org.apache.lucene.codecs.lucene42.Lucene42Codec; //导入依赖的package包/类
public CheapBastardCodec() {
  super("CheapBastard", new Lucene42Codec());
}
 
开发者ID:pkarmstr,项目名称:NYBC,代码行数:4,代码来源:CheapBastardCodec.java


示例9: CompressingCodec

import org.apache.lucene.codecs.lucene42.Lucene42Codec; //导入依赖的package包/类
/**
 * Creates a compressing codec with a given segment suffix
 */
public CompressingCodec(String name, String segmentSuffix, CompressionMode compressionMode, int chunkSize) {
  super(name, new Lucene42Codec());
  this.storedFieldsFormat = new CompressingStoredFieldsFormat(name, segmentSuffix, compressionMode, chunkSize);
  this.termVectorsFormat = new CompressingTermVectorsFormat(name, segmentSuffix, compressionMode, chunkSize);
}
 
开发者ID:pkarmstr,项目名称:NYBC,代码行数:9,代码来源:CompressingCodec.java


示例10: UnRegisteredCodec

import org.apache.lucene.codecs.lucene42.Lucene42Codec; //导入依赖的package包/类
public UnRegisteredCodec() {
  super("NotRegistered", new Lucene42Codec());
}
 
开发者ID:pkarmstr,项目名称:NYBC,代码行数:4,代码来源:TestAddIndexes.java


示例11: MyCodec

import org.apache.lucene.codecs.lucene42.Lucene42Codec; //导入依赖的package包/类
public MyCodec() {
	super("MyCodec", new Lucene42Codec());
	// TODO Auto-generated constructor stub
}
 
开发者ID:o19s,项目名称:lucene_codec_hello_world,代码行数:5,代码来源:MyCodec.java



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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