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

Karl Wright commented on LUCENE-7212:
-------------------------------------

FWIW, the way I'd add bounds computation to shapes by distance would be as 
follows:

(1) Add a method to the GeoDistance interface:
{code}
void getDistanceBounds(DistanceStyle ds, Bounds xxx, double distanceValue);
{code}
The purpose of this method would be to compute the bounds for the current shape 
where the chosen distance metric was less than the specified distanceValue.
(2) Add this method to the following classes:

GeoBaseDistanceShape
GeoDegeneratePoint
GeoStandardCircle
GeoStandardPath

The base class implementation would check if distanceValue was equal to 
MAX_VALUE, and if so would simply compute the bounds for the current shape.  If 
less than that value, it would call an abstract method that would do the job.  
For GeoStandardCircle and GeoStandardPath, the approach taken for doing the 
actual computation would involve newly constructing a constrained 
GeoStandardCircle or GeoStandardPath, and then computing the bounds from that.  
There would likely be new constructors, therefore, which would hopefully 
repurpose planes etc. if possible from the starting GeoStandardCircle or 
GeoStandardPath.  It may be easier code-wise to just build the new shapes from 
scratch, though.

Creating a new complex object is expensive to do both mathematically and in 
terms of object creation.  It really cannot be easily avoided, however.  That 
means that when you call getDistanceBounds() you should expect it to be 
expensive enough that you wouldn't want to do it on every document addition, or 
even every 10.


> Add Geo3DPoint equivalents of LatLonPointDistanceComparator and 
> LatLonPointSortField
> ------------------------------------------------------------------------------------
>
>                 Key: LUCENE-7212
>                 URL: https://issues.apache.org/jira/browse/LUCENE-7212
>             Project: Lucene - Core
>          Issue Type: Improvement
>    Affects Versions: master
>            Reporter: Karl Wright
>            Assignee: Karl Wright
>
> Geo3D has a number of distance measurements and a generic way of computing 
> interior distance.  It would be great to take advantage of that for queries 
> that return results ordered by interior distance.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

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

Reply via email to