Example usage for org.apache.lucene.spatial.query SpatialOperation IsEqualTo

List of usage examples for org.apache.lucene.spatial.query SpatialOperation IsEqualTo

Introduction

In this page you can find the example usage for org.apache.lucene.spatial.query SpatialOperation IsEqualTo.

Prototype

SpatialOperation IsEqualTo

To view the source code for org.apache.lucene.spatial.query SpatialOperation IsEqualTo.

Click Source Link

Document

Meets the "Equals" OGC definition.

Usage

From source file:org.apache.solr.legacy.BBoxStrategy.java

License:Apache License

@Override
public Query makeQuery(SpatialArgs args) {
    Shape shape = args.getShape();
    if (!(shape instanceof Rectangle))
        throw new UnsupportedOperationException("Can only query by Rectangle, not " + shape);

    Rectangle bbox = (Rectangle) shape;
    Query spatial;/*w ww  . j a  va  2  s  .c  om*/

    // Useful for understanding Relations:
    // http://edndoc.esri.com/arcsde/9.1/general_topics/understand_spatial_relations.htm
    SpatialOperation op = args.getOperation();
    if (op == SpatialOperation.BBoxIntersects)
        spatial = makeIntersects(bbox);
    else if (op == SpatialOperation.BBoxWithin)
        spatial = makeWithin(bbox);
    else if (op == SpatialOperation.Contains)
        spatial = makeContains(bbox);
    else if (op == SpatialOperation.Intersects)
        spatial = makeIntersects(bbox);
    else if (op == SpatialOperation.IsEqualTo)
        spatial = makeEquals(bbox);
    else if (op == SpatialOperation.IsDisjointTo)
        spatial = makeDisjoint(bbox);
    else if (op == SpatialOperation.IsWithin)
        spatial = makeWithin(bbox);
    else { //no Overlaps support yet
        throw new UnsupportedSpatialOperation(op);
    }
    return new ConstantScoreQuery(spatial);
}

From source file:org.eclipse.rdf4j.sail.lucene.LuceneIndex.java

License:Open Source License

private SpatialOperation toSpatialOp(String relation) {
    if (GEOF.SF_INTERSECTS.stringValue().equals(relation)) {
        return SpatialOperation.Intersects;
    } else if (GEOF.SF_DISJOINT.stringValue().equals(relation)) {
        return SpatialOperation.IsDisjointTo;
    } else if (GEOF.SF_EQUALS.stringValue().equals(relation)) {
        return SpatialOperation.IsEqualTo;
    } else if (GEOF.SF_OVERLAPS.stringValue().equals(relation)) {
        return SpatialOperation.Overlaps;
    } else if (GEOF.EH_COVERED_BY.stringValue().equals(relation)) {
        return SpatialOperation.IsWithin;
    } else if (GEOF.EH_COVERS.stringValue().equals(relation)) {
        return SpatialOperation.Contains;
    }/*  w  ww  .j av a  2 s.c  o m*/
    return null;
}