You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@lucene.apache.org by amir <am...@snappify.co> on 2012/07/09 10:30:24 UTC

Re: Spatial Search

Hi David,
I'm implementing a project using your RecursivePrefixTreeStrategy and it
works fine when I'm only querying 
based on the geo field as I can sort and can get the distance from the score
of the results. However I couldn't figure out how to sort and get the
distance when I combine the geoquery with another query through
booleanquery. I do really appreciate if you could give me a little help to
get the distance value and sort the items based on their distance....

Amir


--
View this message in context: http://lucene.472066.n3.nabble.com/Spatial-Search-tp3623494p3993824.html
Sent from the Lucene - Java Users mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org


Re: Spatial Search

Posted by "David Smiley (@MITRE.org)" <DS...@mitre.org>.
Amir,

CachedDistanceValueSource is indeed poorly named; I need to get renaming it
on the TODO list; I've identified this before.  Calculating the distance is
computationally cheap enough to calculate for the X number of results
(top-20-ish) you are returning in your search results to not bother trying
to cache it, although I don't rule out caching it at some point.

On timing... know that the Lucene spatial module was committed in ~March,
and there has been steady work lately on various components involved
(Spatial4j, Lucene spatial module, Solr adapters).  I *really* want to get
this nailed down for Lucene/Solr 4.  There is a big difference between
simply having working code (that is only partially tested but seems to
work), and addressing documentation, full testing, and consensus on the API
between interested parties (e.g. Chris, Ryan, and me.).  The last bit,
consensus, is what bogs things down, in my experience.

Specifically about the 1/distance thing... not sure when that'll happen,
maybe in a couple weeks.  Maybe.  I created a JIRA issue so you can start
watching it to be notified of progress:
https://issues.apache.org/jira/browse/LUCENE-4208

~ David

-----
 Author: http://www.packtpub.com/apache-solr-3-enterprise-search-server/book
--
View this message in context: http://lucene.472066.n3.nabble.com/Spatial-Search-tp3623494p3994211.html
Sent from the Lucene - Java Users mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org


Re: Spatial Search

Posted by Amir <am...@snappify.co>.
Thanks heaps for the quick reply David... 
Computing the distance on the client is not an issue, however I was
wondering as you are already computing the distances, there is any caching
mechanism that I could retrieve the computed values. I looked into
CachedDistanceValueSource class etc, but apparently there are for caching
shapes. 

I reckon 1/distance makes much more sense specially when combining geo query
with other queries. Do you mind if I ask when do you plan to apply this
change? I'm using your library in the production environment :D so I'm super
interested in the updates.

Another question is sorting, do you have any tips for sorting?

--
View this message in context: http://lucene.472066.n3.nabble.com/Spatial-Search-tp3623494p3994049.html
Sent from the Lucene - Java Users mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org


Re: Spatial Search

Posted by "David Smiley (@MITRE.org)" <DS...@mitre.org>.
Amir,
  The geo query's score happens to be the distance but I don't expect that
to remain so.  I plan for it to be 1/distance which is a better relevancy
value -- a "score" is supposed to be about relevancy after all.  If you want
to get the distance for a search result, I recommend calculating it on the
client.  It's not hard; you can find code samples for the Haversine
algorithm all over the web.  I want to eventually add a Solr function that
can return the distance in the search results, and even pre-filter the
values by the query shape -- useful for multi-value geo.

~ David

-----
 Author: http://www.packtpub.com/apache-solr-3-enterprise-search-server/book
--
View this message in context: http://lucene.472066.n3.nabble.com/Spatial-Search-tp3623494p3993925.html
Sent from the Lucene - Java Users mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org