You are viewing a plain text version of this content. The canonical link for it is here.
Posted to solr-user@lucene.apache.org by Pavel Minchenkov <ch...@gmail.com> on 2010/07/27 18:47:15 UTC
SpatialSearch: sorting by distance
Hi,
I'm trying to sort by distance like this:
sort=dist(2,lat,lon,55.755786,37.617633) asc
In general results are sorted, but some documents are not in right order.
I'm using DistanceUtils.getDistanceMi(...) from lucene spatial to calculate
real distance after reading documents from Solr.
Solr version from trunk.
<fieldType name="double" class="solr.TrieDoubleField" precisionStep="0"
omitNorms="true" positionIncrementGap="0"/>
<field name="lat" type="double" indexed="true" stored="true"/>
<field name="lon" type="double" indexed="true" stored="true"/>
Thanks.
--
Pavel Minchenkov
Re: SpatialSearch: sorting by distance
Posted by Pavel Minchenkov <ch...@gmail.com>.
Does anybody know if this feature works correctly?
Or I'm doing something wrong?
2010/7/27 Pavel Minchenkov <ch...@gmail.com>
> Hi,
>
> I'm trying to sort by distance like this:
>
> sort=dist(2,lat,lon,55.755786,37.617633) asc
>
> In general results are sorted, but some documents are not in right order.
> I'm using DistanceUtils.getDistanceMi(...) from lucene spatial to calculate
> real distance after reading documents from Solr.
>
> Solr version from trunk.
>
> <fieldType name="double" class="solr.TrieDoubleField" precisionStep="0"
> omitNorms="true" positionIncrementGap="0"/>
> <field name="lat" type="double" indexed="true" stored="true"/>
> <field name="lon" type="double" indexed="true" stored="true"/>
>
> Thanks.
>
> --
> Pavel Minchenkov
>
--
Pavel Minchenkov
Re: does this indicate a commit happened for every add?
Posted by Chris Hostetter <ho...@fucit.org>.
: Subject: does this indicate a commit happened for every add?
: In-Reply-To: <AA...@mail.gmail.com>
: References: <AA...@mail.gmail.com>
http://people.apache.org/~hossman/#threadhijack
Thread Hijacking on Mailing Lists
When starting a new discussion on a mailing list, please do not reply to
an existing message, instead start a fresh email. Even if you change the
subject line of your email, other mail headers still track which thread
you replied to and your question is "hidden" in that thread and gets less
attention. It makes following discussions in the mailing list archives
particularly difficult.
See Also: http://en.wikipedia.org/wiki/User:DonDiego/Thread_hijacking
-Hoss
does this indicate a commit happened for every add?
Posted by Robert Petersen <ro...@buy.com>.
I'm adding lots of small docs with several threads to solr and the adds
start fast but then slow down. I didn't do any explicit commits and
autocommit is turned off but the logs show lots of commit activity on
this core and restarting this solr core logged the below. Where did all
these commits come from, the exact same number as my adds? I'm
stumped...
Jul 27, 2010 10:07:17 AM org.apache.solr.update.DirectUpdateHandler2
close
INFO: closed
DirectUpdateHandler2{commits=456389,autocommits=0,optimizes=0,rollbacks=
0,expungeDeletes=0,docsPending=0,adds=0,deletesById=0,deletesByQuery=0,e
rrors=0,cumulative_adds=456393,cumulative_deletesById=0,cumulative_delet
esByQuery=0,cumulative_errors=0}
Re: SpatialSearch: sorting by distance
Posted by Chris Hostetter <ho...@fucit.org>.
: sort=dist(2,lat,lon,55.755786,37.617633) asc
:
: In general results are sorted, but some documents are not in right order.
: I'm using DistanceUtils.getDistanceMi(...) from lucene spatial to calculate
: real distance after reading documents from Solr.
according ot the wiki for hte "dist" function...
"Return the Distance between two Vectors (points)
in an n-dimensional space."
..and the "2" param in your call means it's going to use the Euclidean
Distance.
where as DistanceUtils.getDistanceMi (allthough undocumented) suggests
that it will return a distance in miles (skimming the code seems to bear
this out ... it just calls getLLMDistance which calls p1.arcDistance( p2,
DistanceUnits.MILES)
I know very little about the spatial package, but i know enough to know
that a vector distance between two arbitrary points in a two dimensional
space is not the same as the distance between two points on *earth* in
miles.
I believe what you want to be using is the "hsin" function
In older versions of SOlr Spatial support, in order for it to work with
"miles on earth" you had to provide the "radius of the earth in miles" as
a param ... i believe that is still possible (and how you cna get the
poutput in other units, like km, or feet), but on the current trunk just
specifying the points should give you the distance in miles by default.
-Hoss