congrats Icon
New! Announcing Tabnine Chat Beta
Learn More
Tabnine Logo
GeoUtils.distanceQuerySortKey
Code IndexAdd Tabnine to your IDE (free)

How to use
distanceQuerySortKey
method
in
org.apache.lucene.geo.GeoUtils

Best Java code snippets using org.apache.lucene.geo.GeoUtils.distanceQuerySortKey (Showing top 4 results out of 315)

origin: org.apache.lucene/lucene-core

/** Create a predicate that checks whether points are within a distance of a given point.
 *  It works by computing the bounding box around the circle that is defined
 *  by the given points/distance and splitting it into between 1024 and 4096
 *  smaller boxes (4096*0.75^2=2304 on average). Then for each sub box, it
 *  computes the relation between this box and the distance query. Finally at
 *  search time, it first computes the sub box that the point belongs to,
 *  most of the time, no distance computation will need to be performed since
 *  all points from the sub box will either be in or out of the circle.
 *  @lucene.internal */
public static DistancePredicate createDistancePredicate(double lat, double lon, double radiusMeters) {
 final Rectangle boundingBox = Rectangle.fromPointDistance(lat, lon, radiusMeters);
 final double axisLat = Rectangle.axisLat(lat, radiusMeters);
 final double distanceSortKey = GeoUtils.distanceQuerySortKey(radiusMeters);
 final Function<Rectangle, Relation> boxToRelation = box -> GeoUtils.relate(
   box.minLat, box.maxLat, box.minLon, box.maxLon, lat, lon, distanceSortKey, axisLat);
 final Grid subBoxes = createSubBoxes(boundingBox, boxToRelation);
 return new DistancePredicate(
   subBoxes.latShift, subBoxes.lonShift,
   subBoxes.latBase, subBoxes.lonBase,
   subBoxes.maxLatDelta, subBoxes.maxLonDelta,
   subBoxes.relations,
   lat, lon, distanceSortKey);
}
origin: org.apache.lucene/lucene-core

final double sortKey = GeoUtils.distanceQuerySortKey(radiusMeters);
origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.lucene

/** Create a predicate that checks whether points are within a distance of a given point.
 *  It works by computing the bounding box around the circle that is defined
 *  by the given points/distance and splitting it into between 1024 and 4096
 *  smaller boxes (4096*0.75^2=2304 on average). Then for each sub box, it
 *  computes the relation between this box and the distance query. Finally at
 *  search time, it first computes the sub box that the point belongs to,
 *  most of the time, no distance computation will need to be performed since
 *  all points from the sub box will either be in or out of the circle.
 *  @lucene.internal */
public static DistancePredicate createDistancePredicate(double lat, double lon, double radiusMeters) {
 final Rectangle boundingBox = Rectangle.fromPointDistance(lat, lon, radiusMeters);
 final double axisLat = Rectangle.axisLat(lat, radiusMeters);
 final double distanceSortKey = GeoUtils.distanceQuerySortKey(radiusMeters);
 final Function<Rectangle, Relation> boxToRelation = box -> GeoUtils.relate(
   box.minLat, box.maxLat, box.minLon, box.maxLon, lat, lon, distanceSortKey, axisLat);
 final Grid subBoxes = createSubBoxes(boundingBox, boxToRelation);
 return new DistancePredicate(
   subBoxes.latShift, subBoxes.lonShift,
   subBoxes.latBase, subBoxes.lonBase,
   subBoxes.maxLatDelta, subBoxes.maxLonDelta,
   subBoxes.relations,
   lat, lon, distanceSortKey);
}
origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.lucene

final double sortKey = GeoUtils.distanceQuerySortKey(radiusMeters);
org.apache.lucene.geoGeoUtilsdistanceQuerySortKey

Javadoc

binary search to find the exact sortKey needed to match the specified radius any sort key lte this is a query match.

Popular methods of GeoUtils

  • checkLatitude
    validates latitude value is within standard +/-90 coordinate bounds
  • checkLongitude
    validates longitude value is within standard +/-180 coordinate bounds
  • orient
    Returns a positive value if points a, b, and c are arranged in counter-clockwise order, negative val
  • lineCrossesLine
    uses orient method to compute whether two line segments cross
  • relate
    Compute the relation between the provided box and distance query. This only works for boxes that do
  • sloppySin
    Returns the trigonometric sine of an angle converted as a cos operation. Note that this is not quite
  • within90LonDegrees
    Return whether all points of [minLon,maxLon] are within 90 degrees of lon.

Popular in Java

  • Running tasks concurrently on multiple threads
  • addToBackStack (FragmentTransaction)
  • getContentResolver (Context)
  • getExternalFilesDir (Context)
  • InputStream (java.io)
    A readable source of bytes.Most clients will use input streams that read data from the file system (
  • InetAddress (java.net)
    An Internet Protocol (IP) address. This can be either an IPv4 address or an IPv6 address, and in pra
  • Arrays (java.util)
    This class contains various methods for manipulating arrays (such as sorting and searching). This cl
  • Deque (java.util)
    A linear collection that supports element insertion and removal at both ends. The name deque is shor
  • ResourceBundle (java.util)
    ResourceBundle is an abstract class which is the superclass of classes which provide Locale-specifi
  • DateTimeFormat (org.joda.time.format)
    Factory that creates instances of DateTimeFormatter from patterns and styles. Datetime formatting i
  • Github Copilot alternatives
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now