本文整理汇总了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();
}
示例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;
}
};
}
示例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;
}
};
}
示例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);
}
示例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);
}
示例6: LireCustomCodec
import org.apache.lucene.codecs.lucene42.Lucene42Codec; //导入依赖的package包/类
public LireCustomCodec() {
super("LireCustomCodec", new Lucene42Codec());
}
示例7: AssertingCodec
import org.apache.lucene.codecs.lucene42.Lucene42Codec; //导入依赖的package包/类
public AssertingCodec() {
super("Asserting", new Lucene42Codec());
}
示例8: CheapBastardCodec
import org.apache.lucene.codecs.lucene42.Lucene42Codec; //导入依赖的package包/类
public CheapBastardCodec() {
super("CheapBastard", new Lucene42Codec());
}
示例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);
}
示例10: UnRegisteredCodec
import org.apache.lucene.codecs.lucene42.Lucene42Codec; //导入依赖的package包/类
public UnRegisteredCodec() {
super("NotRegistered", new Lucene42Codec());
}
示例11: MyCodec
import org.apache.lucene.codecs.lucene42.Lucene42Codec; //导入依赖的package包/类
public MyCodec() {
super("MyCodec", new Lucene42Codec());
// TODO Auto-generated constructor stub
}