lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "David Smiley (" <>
Subject Re: Spatial Search
Date Tue, 03 Jan 2012 15:59:08 GMT
I have a couple comments on your code after briefly looking through it.

* If you want to work with miles, initialize SimpleSpatialContext with
DistanceUnits.MILES.  I see you chose KM but your leading statistics are in
miles.  Perhaps that is the reason for the discrepency in your numbers.
* You are not supposed to instantiate Shape instances directly, the spatial
context is a factory for them.  It will also do some important argument
normalization (e.g. ensuring lat-lon is within proper boundaries).
* You are initializing GeohashPrefixTree using the maximum detail possible
(roughly double precision).  I suspect you don't actually need that level of
accuracy.  Look at SpatialPrefixTreeStrategy.initMaxLevels() for code that
chooses a value based on a target fraction of your chosen units (e.g.
miles).  If you want to hard-code a specific value only good for geohashes,
you could alternatively look up a value in a table of precision on geohashes
on wikipedia.

Keep in mind that LSP is subject to change at will; it hasn't been
officially released yet.  The remaining issues I see for a first release are
enumerated here:  The "Extras /
demo related" part arguably doesn't count.

~ David Smiley

View this message in context:
Sent from the Lucene - Java Users mailing list archive at

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message