use of org.apache.lucene.spatial.query.SpatialOperation in project lucene-solr by apache.
the class TestBBoxStrategy method testOperations.
@Test
@Repeat(iterations = 15)
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 = BBoxStrategy.newInstance(ctx, "bbox");
//test we can disable docValues for predicate tests
if (random().nextBoolean()) {
FieldType fieldType = new FieldType(((BBoxStrategy) strategy).getFieldType());
fieldType.setDocValuesType(DocValuesType.NONE);
strategy = new BBoxStrategy(ctx, strategy.getFieldName(), fieldType);
}
for (SpatialOperation operation : SpatialOperation.values()) {
if (operation == SpatialOperation.Overlaps)
//unsupported
continue;
testOperationRandomShapes(operation);
deleteAll();
commit();
}
}
Aggregations