In this case of *query 2* as mentioned in previous mail, there will be
distance calculation using *distance:geodist(0,0,**latlon)* as it will take
the default lat and lon values , so how it can return the variable distance.

With Regards
Aman Tandon


On Tue, Apr 8, 2014 at 5:06 PM, Aman Tandon <amantandon...@gmail.com> wrote:

> Hi Sir,
>
> *Scenario*:
> I have to return the distances for every city search so I make these 
> configurations as described below.
>
> *solrconfig.xml:  *
> My request handler is "im.search" and its defaults are
>
> <lst name="defaults">
>                         <str name="echoParams">none</str>
>                         <str name="wt">json</str>
>                         <str name="rows">20</str>
>                       <str name="lat">0</str>
>                         <str name="lon">0</str>
>
>    </lst>
>
> <str name="fl">title,city,state,distance:geodist($lat,$lon,latlon)</str>
>
>
> *schema.xml: *
>
> <fieldType name="latlongtype" class="solr.LatLonType" 
> subFieldSuffix="_coordinate"/>
>
> <field name="latlon" type="latlongtype" indexed="true" stored="true" 
> required="false" multiValued="false" />
>
>
> *query 1:  *
>
> *http://localhost:8020/solr/search1/select/?q=bags&qt=im.search&ps=1&group.limit=1&spellcheck=true&lat=23.26667&lon=77.4&boost=recip(geodist(23.26667,77.4,latlon),13.97,12000,5000)&facet.query=city
> <http://localhost:8020/solr/search1/select/?q=bags&qt=im.search&ps=1&group.limit=1&spellcheck=true&lat=23.26667&lon=77.4&boost=recip(geodist(23.26667,77.4,latlon),13.97,12000,5000)&facet.query=city>:"bhopal"*
>
> *Results:*
>     {
>         "title":"Colored Gift Bags",
>         "city":"Indore",
>         "state":"Madhya Pradesh",
>         "distance":171.58415508651908},
>       {
>         "title":"Paper Carry Bags",
>         "city":"Indore",
>         "state":"Madhya Pradesh",
>         "distance":171.58415508651908},
>       {
>         "title":"Handmade Paper Bags",
>         "city":"Indore",
>         "state":"Madhya Pradesh",
>         "distance":171.58415508651908},
>       {
>         "title":"Bulk Bags",
>         "city":"Indore",
>         "state":"Madhya Pradesh",
>         "distance":171.58415508651908},
>       {
>         "title":"Filter Bags",
>         "city":"Indore",
>         "state":"Madhya Pradesh",
>         "distance":171.58415508651908},
>       {
>         "title":"HDPE Woven Bags",
>         "city":"Indore",
>         "state":"Madhya Pradesh",
>         "distance":171.58415508651908
>        }
>
> which is fine for all the distance calculation
>
> *query 2:*
> *http://localhost:8020/solr/search1/select/?q=bags&qt=im.search&ps=1&group.limit=1&spellcheck=true
> <http://localhost:8020/solr/search1/select/?q=bags&qt=im.search&ps=1&group.limit=1&spellcheck=true>*
>
> *Results:*
> {
>         "title":"PVC Transparent Bags",
>         "city":"Ghaziabad",
>         "state":"Uttar Pradesh",
>         "distance":8783.780020683036},
>       {
>         "title":"Sand Bags",
>         "city":"Bharuch",
>         "state":"Gujarat",
>         "distance":8251.412123848868},
>       {
>         "title":"Carry Bags",
>         "city":"Mumbai",
>         "state":"Maharashtra",
>         "distance":8211.624964681945},
>       {
>         "title":"Shoulder Bags",
>         "city":"Mumbai",
>         "state":"Maharashtra",
>         "distance":8211.624964681945},
>       {
>         "title":"Valve Type Bags",
>         "city":"Bharuch",
>         "state":"Gujarat",
>         "distance":8251.412123848868},
>       {
>         "title":"Laptop Bags",
>         "city":"Delhi",
>         "state":"Delhi",
>         "distance":8762.7634687622},
>       {
>         "title":"Jute Bags",
>         "city":"Ghaziabad",
>         "state":"Uttar Pradesh",
>         "distance":8783.780020683036
>      }
>
> But in this case i am getting the variable distance which is not
> understandable that how and using which area coordinate, it is calculating
> the distance, because i think it must be some constant in this case.
>
> With Regards
> Aman Tandon
>
>
> On Mon, Apr 7, 2014 at 8:09 PM, david.w.smi...@gmail.com <
> david.w.smi...@gmail.com> wrote:
>
>> Hi,
>>
>> I'm not sure why you are asking or maybe I'm not getting what you *really*
>> want to know.  You'll get the geodesic distance (i.e. the "great circle
>> distance", the distance on the surface of a sphere) from 0,0 (off the
>> coast
>> of Africa), to each point indexed in your "location" field.
>>
>> ~ David
>>
>>
>>
>> On Mon, Apr 7, 2014 at 7:06 AM, Aman Tandon <amantandon...@gmail.com>
>> wrote:
>>
>> > Hello,
>> >
>> > In my index, i am using the LatlonType, for using the geodist to
>> calculate
>> > the distance, and i am using it like geodist(lat, lon, location). Can
>> > anybody told me what value the geodist will return if i will pass
>> > geodist(0, 0, location)
>> >
>> > Thanks
>> > Aman Tandon
>> >
>>
>
>

Reply via email to