[ 
https://issues.apache.org/jira/browse/LUCENE-7392?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16022537#comment-16022537
 ] 

Adrien Grand commented on LUCENE-7392:
--------------------------------------

{code}
+  /** rewrite the dateline crossing query to separate western hemisphere and 
expanded eastern hemisphere */
+  private static Query newXDLQuery(String field, final double minLat, final 
double minLon,
+                                   final double maxLat, final double maxLon, 
final RangeFieldQuery.QueryType queryType) {
+    BooleanQuery.Builder bqb = new BooleanQuery.Builder();
+    bqb.add(bboxQuery(field, minLat, GeoUtils.MIN_LON_INCL, maxLat, maxLon, 
queryType), BooleanClause.Occur.SHOULD);
+    bqb.add(bboxQuery(field, minLat, minLon, maxLat, 360.0D + maxLon, 
queryType), BooleanClause.Occur.SHOULD);
+    return bqb.build();
+  }
{code}

This looks suspicious to me. The fact that the first bbox has a constant 
minimum longitude would cause bugs I think with CONTAINS, WITHIN and CROSSES? 
Shouldn't it be just:
{code}
+  /** rewrite the dateline crossing query to separate western hemisphere and 
expanded eastern hemisphere */
+  private static Query newXDLQuery(String field, final double minLat, final 
double minLon,
+                                   final double maxLat, final double maxLon, 
final RangeFieldQuery.QueryType queryType) {
+    return bboxQuery(field, minLat, minLon, maxLat, 360.0D + maxLon, 
queryType);
+  }
{code}

At the moment, your patch performs quantization both at index-time and 
search-time. I think it would be nicer if the impact of quantization only 
applied to the indexed bboxes, which may be doable by rounding the low/high 
bounds of the query down or up depending on the query type?

> Add point based GeoBoundingBoxField as a new RangeField type
> ------------------------------------------------------------
>
>                 Key: LUCENE-7392
>                 URL: https://issues.apache.org/jira/browse/LUCENE-7392
>             Project: Lucene - Core
>          Issue Type: Improvement
>            Reporter: Nicholas Knize
>         Attachments: LUCENE-7392.patch, LUCENE-7392.patch
>
>
> This issue will add a new point based {{GeoBoundingBoxField}} type for 
> indexing and querying 2D or 3D Geo bounding boxes. The intent is to construct 
> this as a RangeField type and limit the first two dimensions to the lat/lon 
> geospatial bounds (at 4 bytes each like {{LatLonPoint}}, while allowing an 
> optional 8 byte ({{double}}) third dimension to serve as an altitude 
> component for indexing 3D geospatial bounding boxes.



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to