use of org.apache.lucene.spatial.util.ShapePredicateValueSource in project lucene-solr by apache.
the class CompositeSpatialStrategy method makeQuery.
@Override
public Query makeQuery(SpatialArgs args) {
final SpatialOperation pred = args.getOperation();
if (pred == SpatialOperation.BBoxIntersects || pred == SpatialOperation.BBoxWithin) {
throw new UnsupportedSpatialOperation(pred);
}
if (pred == SpatialOperation.IsDisjointTo) {
// update class docs when it's added.
throw new UnsupportedSpatialOperation(pred);
}
final ShapePredicateValueSource predicateValueSource = new ShapePredicateValueSource(geometryStrategy.makeShapeValueSource(), pred, args.getShape());
//System.out.println("PredOpt: " + optimizePredicates);
if (pred == SpatialOperation.Intersects && optimizePredicates) {
// We have a smart Intersects impl
final SpatialPrefixTree grid = indexStrategy.getGrid();
//default to max precision
final int detailLevel = grid.getLevelForDistance(args.resolveDistErr(ctx, 0.0));
return new IntersectsRPTVerifyQuery(args.getShape(), indexStrategy.getFieldName(), grid, detailLevel, indexStrategy.getPrefixGridScanLevel(), predicateValueSource);
} else {
//The general path; all index matches get verified
SpatialArgs indexArgs;
if (pred == SpatialOperation.Contains) {
// note: we could map IsWithin as well but it's pretty darned slow since it touches all world grids
indexArgs = args;
} else {
//TODO add args.clone method with new predicate? Or simply make non-final?
indexArgs = new SpatialArgs(SpatialOperation.Intersects, args.getShape());
indexArgs.setDistErr(args.getDistErr());
indexArgs.setDistErrPct(args.getDistErrPct());
}
if (indexArgs.getDistErr() == null && indexArgs.getDistErrPct() == null) {
indexArgs.setDistErrPct(0.10);
}
final Query indexQuery = indexStrategy.makeQuery(indexArgs);
return new CompositeVerifyQuery(indexQuery, predicateValueSource);
}
}
use of org.apache.lucene.spatial.util.ShapePredicateValueSource in project lucene-solr by apache.
the class SerializedDVStrategy method makeQuery.
/**
* Returns a Query that should be used in a random-access fashion.
* Use in another manner will be SLOW.
*/
@Override
public Query makeQuery(SpatialArgs args) {
ValueSource shapeValueSource = makeShapeValueSource();
ShapePredicateValueSource predicateValueSource = new ShapePredicateValueSource(shapeValueSource, args.getOperation(), args.getShape());
return new PredicateValueSourceQuery(predicateValueSource);
}
Aggregations