jpountz commented on code in PR #897:
URL: https://github.com/apache/lucene/pull/897#discussion_r880768892


##########
lucene/core/src/java/org/apache/lucene/document/NearestNeighbor.java:
##########
@@ -220,7 +216,7 @@ public Relation compare(byte[] minPackedValue, byte[] 
maxPackedValue) {
   }
 
   /** Holds one hit from {@link NearestNeighbor#nearest} */
-  static class NearestHit {
+  public static class NearestHit {

Review Comment:
   can it remain pkg-private too?



##########
lucene/core/src/java/org/apache/lucene/document/LatLonPoint.java:
##########
@@ -362,4 +375,71 @@ public static Query newDistanceFeatureQuery(
     }
     return query;
   }
+
+  /**
+   * Finds the {@code n} nearest indexed points to the provided point, 
according to Haversine
+   * distance.
+   *
+   * <p>This is functionally equivalent to running {@link MatchAllDocsQuery} 
with a {@link
+   * LatLonDocValuesField#newDistanceSort}, but is far more efficient since it 
takes advantage of
+   * properties the indexed BKD tree. Multi-valued fields are currently not 
de-duplicated, so if a
+   * document had multiple instances of the specified field that make it into 
the top n, that
+   * document will appear more than once.
+   *
+   * <p>Documents are ordered by ascending distance from the location. The 
value returned in {@link
+   * FieldDoc} for the hits contains a Double instance with the distance in 
meters.
+   *
+   * @param searcher IndexSearcher to find nearest points from.
+   * @param field field name. must not be null.
+   * @param latitude latitude at the center: must be within standard +/-90 
coordinate bounds.
+   * @param longitude longitude at the center: must be within standard +/-180 
coordinate bounds.
+   * @param n the number of nearest neighbors to retrieve.
+   * @return TopFieldDocs containing documents ordered by distance, where the 
field value for each
+   *     {@link FieldDoc} is the distance in meters
+   * @throws IllegalArgumentException if the underlying PointValues is not a 
{@code
+   *     Lucene60PointsReader} (this is a current limitation), or if {@code 
field} or {@code

Review Comment:
   we removed this limitation that `Lucene60PointsReader` is required



-- 
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.

To unsubscribe, e-mail: issues-unsubscr...@lucene.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


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

Reply via email to