The future of geo-spatial searches with Lucene

Or: Introducing Spatial4n

The Lucene spatial contrib module has been a nice addition to Lucene, but for a while now too many bug reports have been piling up, and it got to a point where it was clear something was broken somewhere deep inside. Luckily, a bunch of good people started writing their own general purpose geo-spatial library in Java, and provided a Lucene module to interact with it to provide spatial search functionality. This project is called Spatial4j (formerly Lucene Spatial Playground), and it works great, solving all known issues with the previous implementation.

What's even more great about it is it was built from the ground up to support complex searches, like polygons and other custom shapes, as well as different search strategies. This is not just about a circle and a radius anymore. The guys that created it really dig geo-spatial searches, so it is probably going to get a lot better over time.

This library as well as it's accompanying Lucene module are now part of Lucene, and should be available to all when Lucene 4.0 is released. Since RavenDB uses the old spatial module, we were getting quite a few bug reports ourselves, without really being able to do anything about it. So when we heard about this project, it was clear that we should be using it. And since it is written in Java, well - luckily this isn't the first piece of Java code I've been porting... The Spatial4n library - the .NET version of Spatial4j - is available here: https://github.com/synhershko/Spatial4n The Lucene part of things, sync'd with Lucene.NET's trunk, can be found here: https://github.com/synhershko/lucene.net/tree/spatial2trunk . It will be there until those are merged upstream. There is also a branch with the new spatial module that is compatible with the 2.9.4 API - https://github.com/synhershko/lucene.net/tree/spatial. We had to do some custom coding to get it to work with all the functionality we wanted, but it was all doable and so far this library looks very promising. All it needs now is a bit more attention.

Comments

  • Albert

    Hello! Do you have any link with some documentation when I can see how to do spatial searches with Spatial4net? :)

    I'm just migrating to Lucene.net 3.0.3 and I'm quite lost.

    Thanks!

  • Andrew

    What's the latest version of Spatial4n? On github, there appears to be version 1.0, but on nuget, it's .03?

    Thanks in advance.

Comments are now closed