You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@lucene.apache.org by GitBox <gi...@apache.org> on 2020/02/14 12:02:57 UTC

[GitHub] [lucene-solr] iverase opened a new pull request #1258: LUCENE-9225: Rectangle should extend LatLonGeometry

iverase opened a new pull request #1258: LUCENE-9225: Rectangle should extend LatLonGeometry
URL: https://github.com/apache/lucene-solr/pull/1258
 
 
   Rectangle now extends LatLonGeometry so it can be used as part of a geometry collection. We need to be careful for Contains and we need to split the rectangle in two if it crossest the dateline. 
   
   Test is added to check we get the same results from tLatLotBoundingBoxQuery and the corresponding geometry query.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@lucene.apache.org
For additional commands, e-mail: issues-help@lucene.apache.org


[GitHub] [lucene-solr] iverase merged pull request #1258: LUCENE-9225: Rectangle should extend LatLonGeometry

Posted by GitBox <gi...@apache.org>.
iverase merged pull request #1258: LUCENE-9225: Rectangle should extend LatLonGeometry
URL: https://github.com/apache/lucene-solr/pull/1258
 
 
   

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@lucene.apache.org
For additional commands, e-mail: issues-help@lucene.apache.org


[GitHub] [lucene-solr] nknize commented on a change in pull request #1258: LUCENE-9225: Rectangle should extend LatLonGeometry

Posted by GitBox <gi...@apache.org>.
nknize commented on a change in pull request #1258: LUCENE-9225: Rectangle should extend LatLonGeometry
URL: https://github.com/apache/lucene-solr/pull/1258#discussion_r380381973
 
 

 ##########
 File path: lucene/core/src/java/org/apache/lucene/geo/Rectangle2D.java
 ##########
 @@ -415,16 +217,63 @@ public boolean equals(Object o) {
     return minX == that.minX &&
         maxX == that.maxX &&
         minY == that.minY &&
-        maxY == that.maxY &&
-        Arrays.equals(bbox, that.bbox) &&
-        Arrays.equals(west, that.west);
+        maxY == that.maxY;
   }
 
   @Override
   public int hashCode() {
     int result = Objects.hash(minX, maxX, minY, maxY);
-    result = 31 * result + Arrays.hashCode(bbox);
-    result = 31 * result + Arrays.hashCode(west);
     return result;
   }
-}
+
+  @Override
+  public String toString() {
+    final StringBuilder sb = new StringBuilder();
+    sb.append("XYRectangle(x=");
+    sb.append(minX);
+    sb.append(" TO ");
+    sb.append(maxX);
+    sb.append(" y=");
+    sb.append(minY);
+    sb.append(" TO ");
+    sb.append(maxY);
+    sb.append(")");
+    return sb.toString();
+  }
+
+  /** create a component2D from the provided XY rectangle */
+  static Component2D create(XYRectangle rectangle) {
+    return new Rectangle2D(rectangle.minX, rectangle.maxX, rectangle.minY, rectangle.maxY);
+  }
+
+  private static double MIN_LON_INCL_QUANTIZE = decodeLongitude(encodeLongitude(MIN_LON_INCL));
 
 Review comment:
   ```suggestion
     private static double MIN_LON_INCL_QUANTIZE = decodeLongitude(GeoEncodingUtils.MIN_LON_ENCODED);
   ```

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@lucene.apache.org
For additional commands, e-mail: issues-help@lucene.apache.org


[GitHub] [lucene-solr] nknize commented on a change in pull request #1258: LUCENE-9225: Rectangle should extend LatLonGeometry

Posted by GitBox <gi...@apache.org>.
nknize commented on a change in pull request #1258: LUCENE-9225: Rectangle should extend LatLonGeometry
URL: https://github.com/apache/lucene-solr/pull/1258#discussion_r380382109
 
 

 ##########
 File path: lucene/core/src/java/org/apache/lucene/geo/Rectangle2D.java
 ##########
 @@ -415,16 +217,63 @@ public boolean equals(Object o) {
     return minX == that.minX &&
         maxX == that.maxX &&
         minY == that.minY &&
-        maxY == that.maxY &&
-        Arrays.equals(bbox, that.bbox) &&
-        Arrays.equals(west, that.west);
+        maxY == that.maxY;
   }
 
   @Override
   public int hashCode() {
     int result = Objects.hash(minX, maxX, minY, maxY);
-    result = 31 * result + Arrays.hashCode(bbox);
-    result = 31 * result + Arrays.hashCode(west);
     return result;
   }
-}
+
+  @Override
+  public String toString() {
+    final StringBuilder sb = new StringBuilder();
+    sb.append("XYRectangle(x=");
+    sb.append(minX);
+    sb.append(" TO ");
+    sb.append(maxX);
+    sb.append(" y=");
+    sb.append(minY);
+    sb.append(" TO ");
+    sb.append(maxY);
+    sb.append(")");
+    return sb.toString();
+  }
+
+  /** create a component2D from the provided XY rectangle */
+  static Component2D create(XYRectangle rectangle) {
+    return new Rectangle2D(rectangle.minX, rectangle.maxX, rectangle.minY, rectangle.maxY);
+  }
+
+  private static double MIN_LON_INCL_QUANTIZE = decodeLongitude(encodeLongitude(MIN_LON_INCL));
+  private static double MAX_LON_INCL_QUANTIZE = decodeLongitude(encodeLongitude(MAX_LON_INCL));
 
 Review comment:
   ```suggestion
     private static double MAX_LON_INCL_QUANTIZE = decodeLongitude(GeoEncodingUtils.MAX_LON_ENCODED);
   ```

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@lucene.apache.org
For additional commands, e-mail: issues-help@lucene.apache.org


[GitHub] [lucene-solr] nknize commented on a change in pull request #1258: LUCENE-9225: Rectangle should extend LatLonGeometry

Posted by GitBox <gi...@apache.org>.
nknize commented on a change in pull request #1258: LUCENE-9225: Rectangle should extend LatLonGeometry
URL: https://github.com/apache/lucene-solr/pull/1258#discussion_r380385091
 
 

 ##########
 File path: lucene/core/src/java/org/apache/lucene/document/LatLonShapeBoundingBoxQuery.java
 ##########
 @@ -108,4 +115,385 @@ public String toString(String field) {
     sb.append(rectangle.toString());
     return sb.toString();
   }
+
+  /** Holds spatial logic for a bounding box that works in the encoded space */
+  private static class EncodedRectangle {
 
 Review comment:
   Is this class needed because `Rectangle2D` is package private?

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@lucene.apache.org
For additional commands, e-mail: issues-help@lucene.apache.org


[GitHub] [lucene-solr] iverase commented on a change in pull request #1258: LUCENE-9225: Rectangle should extend LatLonGeometry

Posted by GitBox <gi...@apache.org>.
iverase commented on a change in pull request #1258: LUCENE-9225: Rectangle should extend LatLonGeometry
URL: https://github.com/apache/lucene-solr/pull/1258#discussion_r386822636
 
 

 ##########
 File path: lucene/core/src/java/org/apache/lucene/document/LatLonShapeBoundingBoxQuery.java
 ##########
 @@ -108,4 +115,385 @@ public String toString(String field) {
     sb.append(rectangle.toString());
     return sb.toString();
   }
+
+  /** Holds spatial logic for a bounding box that works in the encoded space */
+  private static class EncodedRectangle {
 
 Review comment:
   This class is an specialisation for bounding box queries working on the encoded space. As such it feels like the correct place to package this logic is in the query itself. I am pushing this change, if you disagree we can re-think how to package this logic later on.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@lucene.apache.org
For additional commands, e-mail: issues-help@lucene.apache.org