本文整理汇总了Java中org.apache.lucene.document.FieldType.setDocValueType方法的典型用法代码示例。如果您正苦于以下问题:Java FieldType.setDocValueType方法的具体用法?Java FieldType.setDocValueType怎么用?Java FieldType.setDocValueType使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.lucene.document.FieldType
的用法示例。
在下文中一共展示了FieldType.setDocValueType方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testExcIndexingDocBeforeDocValues
import org.apache.lucene.document.FieldType; //导入方法依赖的package包/类
public void testExcIndexingDocBeforeDocValues() throws Exception {
Directory dir = newDirectory();
IndexWriterConfig iwc = new IndexWriterConfig(TEST_VERSION_CURRENT, new MockAnalyzer(random()));
IndexWriter w = new IndexWriter(dir, iwc);
Document doc = new Document();
FieldType ft = new FieldType(TextField.TYPE_NOT_STORED);
ft.setDocValueType(DocValuesType.SORTED);
ft.freeze();
Field field = new Field("test", "value", ft);
field.setTokenStream(new TokenStream() {
@Override
public boolean incrementToken() {
throw new RuntimeException("no");
}
});
doc.add(field);
try {
w.addDocument(doc);
fail("did not hit exception");
} catch (RuntimeException re) {
// expected
}
w.addDocument(new Document());
w.close();
dir.close();
}
示例2: BBoxStrategy
import org.apache.lucene.document.FieldType; //导入方法依赖的package包/类
public BBoxStrategy(SpatialContext ctx, String fieldNamePrefix) {
super(ctx, fieldNamePrefix);
field_bbox = fieldNamePrefix;
field_minX = fieldNamePrefix + SUFFIX_MINX;
field_maxX = fieldNamePrefix + SUFFIX_MAXX;
field_minY = fieldNamePrefix + SUFFIX_MINY;
field_maxY = fieldNamePrefix + SUFFIX_MAXY;
field_xdl = fieldNamePrefix + SUFFIX_XDL;
FieldType fieldType = new FieldType(DoubleField.TYPE_NOT_STORED);
fieldType.setNumericPrecisionStep(8);//Solr's default
fieldType.setDocValueType(FieldInfo.DocValuesType.NUMERIC);
setFieldType(fieldType);
}
示例3: testOperations
import org.apache.lucene.document.FieldType; //导入方法依赖的package包/类
@Test
@Repeat(iterations = 20)
public void testOperations() throws IOException {
//setup
if (random().nextInt(4) > 0) {//75% of the time choose geo (more interesting to test)
this.ctx = SpatialContext.GEO;
} else {
SpatialContextFactory factory = new SpatialContextFactory();
factory.geo = false;
factory.worldBounds = new RectangleImpl(-300, 300, -100, 100, null);
this.ctx = factory.newSpatialContext();
}
this.strategy = new BBoxStrategy(ctx, "bbox");
//test we can disable docValues for predicate tests
if (random().nextBoolean()) {
BBoxStrategy bboxStrategy = (BBoxStrategy) strategy;
FieldType fieldType = new FieldType(bboxStrategy.getFieldType());
fieldType.setDocValueType(null);
bboxStrategy.setFieldType(fieldType);
}
for (SpatialOperation operation : SpatialOperation.values()) {
if (operation == SpatialOperation.Overlaps)
continue;//unsupported
testOperationRandomShapes(operation);
deleteAll();
commit();
}
}