use of org.polymap.recordstore.QueryExpression.BBox in project polymap4-core by Polymap4.
the class GeometryValueCoder method searchQuery.
public Query searchQuery(QueryExpression exp) {
// BBOX
if (exp instanceof QueryExpression.BBox) {
// return !(other.minx > maxx ||
// other.maxx < minx ||
// other.miny > maxy ||
// other.maxy < miny);
// -> !maxx < other.minx && !mixx > other.maxx
// -> maxx > other.minx && minx < other.maxx
BBox bbox = (QueryExpression.BBox) exp;
BooleanQuery result = new BooleanQuery();
// maxx > bbox.getMinX
result.add(numeric.searchQuery(new Greater(bbox.key + FIELD_MAXX, bbox.minX)), BooleanClause.Occur.MUST);
// minx < bbox.getMaxX
result.add(numeric.searchQuery(new Less(bbox.key + FIELD_MINX, bbox.maxX)), BooleanClause.Occur.MUST);
// maxy > bbox.getMinY
result.add(numeric.searchQuery(new Greater(bbox.key + FIELD_MAXY, bbox.minY)), BooleanClause.Occur.MUST);
// miny < bbox.getMaxY
result.add(numeric.searchQuery(new Less(bbox.key + FIELD_MINY, bbox.maxY)), BooleanClause.Occur.MUST);
return result;
}
// }
return null;
}
Aggregations