public Query makeQuery(SpatialArgs args) {if(! SpatialOperation.is( args.getOperation(),SpatialOperation.Intersects,SpatialOperation.IsWithin ))throw new UnsupportedSpatialOperation(args.getOperation());Shape shape = args.getShape();if (shape instanceof Rectangle) {Rectangle bbox = (Rectangle) shape;return new ConstantScoreQuery(makeWithin(bbox));} else if (shape instanceof Circle) {Circle circle = (Circle)shape;Rectangle bbox = circle.getBoundingBox();return new DistanceRangeQuery(makeWithin(bbox), makeDistanceValueSource(circle.getCenter()), circle.getRadius());} else {throw new UnsupportedOperationException("Only Rectangles and Circles are currently supported, " +"found [" + shape.getClass() + "]");}}
public override ConstantScoreQuery MakeQuery(SpatialArgs args){if (!SpatialOperation.Is(args.Operation,SpatialOperation.Intersects,SpatialOperation.IsWithin)){throw new UnsupportedSpatialOperation(args.Operation);}IShape shape = args.Shape;if (shape is IRectangle){var bbox = (IRectangle)shape;return new ConstantScoreQuery(MakeWithin(bbox));}else if (shape is ICircle){var circle = (ICircle)shape;var bbox = circle.BoundingBox;var vsf = new ValueSourceFilter(new QueryWrapperFilter(MakeWithin(bbox)),MakeDistanceValueSource(circle.Center),0,circle.Radius);return new ConstantScoreQuery(vsf);}throw new NotSupportedException("Only IRectangles and ICircles are currently supported, " +"found [" + shape.GetType().Name + "]"); }