Example usage for org.apache.lucene.spatial.prefix RecursivePrefixTreeStrategy makeQuery

List of usage examples for org.apache.lucene.spatial.prefix RecursivePrefixTreeStrategy makeQuery

Introduction

In this page you can find the example usage for org.apache.lucene.spatial.prefix RecursivePrefixTreeStrategy makeQuery.

Prototype

@Override
    public Query makeQuery(SpatialArgs args) 

Source Link

Usage

From source file:org.elasticsearch.search.geo.GeoFilterIT.java

License:Apache License

protected static boolean testRelationSupport(SpatialOperation relation) {
    if (relation == SpatialOperation.IsDisjointTo) {
        // disjoint works in terms of intersection
        relation = SpatialOperation.Intersects;
    }/*from  w w w. j ava 2 s .  co  m*/
    try {
        GeohashPrefixTree tree = new GeohashPrefixTree(SpatialContext.GEO, 3);
        RecursivePrefixTreeStrategy strategy = new RecursivePrefixTreeStrategy(tree, "area");
        Shape shape = SpatialContext.GEO.makePoint(0, 0);
        SpatialArgs args = new SpatialArgs(relation, shape);
        strategy.makeQuery(args);
        return true;
    } catch (UnsupportedSpatialOperation e) {
        e.printStackTrace();
        return false;
    }
}