本文整理汇总了Java中org.apache.lucene.index.FieldInfo.IndexOptions.values方法的典型用法代码示例。如果您正苦于以下问题:Java IndexOptions.values方法的具体用法?Java IndexOptions.values怎么用?Java IndexOptions.values使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.lucene.index.FieldInfo.IndexOptions
的用法示例。
在下文中一共展示了IndexOptions.values方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testFull
import org.apache.lucene.index.FieldInfo.IndexOptions; //导入方法依赖的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);
}
示例2: addRandomFields
import org.apache.lucene.index.FieldInfo.IndexOptions; //导入方法依赖的package包/类
@Override
protected void addRandomFields(Document doc) {
for (IndexOptions opts : IndexOptions.values()) {
final String field = "f_" + opts;
String pf = TestUtil.getPostingsFormat(Codec.getDefault(), field);
if (opts == IndexOptions.DOCS_AND_FREQS_AND_POSITIONS_AND_OFFSETS && doesntSupportOffsets.contains(pf)) {
continue;
}
FieldType ft = new FieldType();
ft.setIndexOptions(opts);
ft.setIndexed(true);
ft.setOmitNorms(true);
ft.freeze();
final int numFields = random().nextInt(5);
for (int j = 0; j < numFields; ++j) {
doc.add(new Field("f_" + opts, TestUtil.randomSimpleString(random(), 2), ft));
}
}
}