Hello Leighton -- Use Lucene Spatial, it's built into Lucene for distance/shape functionality and queries.
Simply google "lucene spatial" for examples, such as: http://stackoverflow.com/questions/13628602/how-to-use-lucene-4-0-spatial-api http://lucene.apache.org/core/4_0_0/spatial/index.html http://svn.apache.org/viewvc/lucene/dev/branches/branch_4x/lucene/spatial/src/test/org/apache/lucene/spatial/SpatialExample.java?view=markup -- Marc Hadfield Vital AI ---------------- Marc C. Hadfield [email protected] @MarcHadfield 917-991-9685 On Wed, May 21, 2014 at 12:30 PM, Leighton Hargreaves < [email protected]> wrote: > Hello Lucene project. > > I'm in the process of evaluating lucene for a project where we will need > to search a large set of 3D objects by various attributes. In many ways, > lucene's functionality seems perfect. > > But one thing I'm not sure of: we need to find the set of objects that are > within a given distance of any given object. > > One solution would to add a numeric field to each 3D object, for each > other 3D object, with a name such as 'distance_to_<other_object_id_1>'. > This would allow us to find objects within a given distance of a given > object with a query like 'distance_to_<object_id>:[ *to <max_distance> ]'. > > But this would mean each 3D object would have several thousand attributes, > one for every other 3D object. Would this be a prohibitively expensive way > to do it? > > Another solution would be to handle the spatial aspect within my own > software ie filter lucene's results according to distance. But I worry > that this would negatively affect performance by causing the set of results > returned to my code to be large, prior to filtering by my own software. > > I apologise if the question is confusing or badly explained, I'm just > asking in case it turns out to be a standard class of problem with good > existing solutions. > > Regards, > > Leighton Hargreaves > >
