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


Java Lucene42Codec类代码示例

本文整理汇总了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;未经允许,请勿转载。