Huh.  Well if you don't want the distance, don't put it in your "fl",
wether it be in the request handler or the request.  It may help to know
that you can specify "fl" multiple times and the field list is ultimately
the set of all of them.  Given that, you could avoid putting
distance:geodist(....) in your request handler definition; just pass it on
the request when you want to compute it and of course have a lat & lon
value.
~ David


On Wed, Apr 9, 2014 at 12:05 AM, Aman Tandon <amantandon...@gmail.com>wrote:

> Sir the problem is that we have too many fields in our *fl*, which i
> didn't mentioned in my previous mail, and we have so many products in our
> organization who are using our search. So in our back end java files we are
> handling their requirements are providing results by customizing  every
> product requirement, if we keep the whole *fl* in our code which is of
> about two-three lines, it will look so bad. So i put it in my request
> handler and initialize it with 0,0 so that in case of non-city based search
> we will ignore it and our products don't get affected from our changes.
>
> But it is still not understandable to me that why it is returning the
> variable distance for every results?
>
>
> On Tue, Apr 8, 2014 at 6:51 PM, david.w.smi...@gmail.com <
> david.w.smi...@gmail.com> wrote:
>
>> You're computing the distance from the locations you've put in your index
>> to 0,0.  Why 0,0?  Wouldn't you want to provide a point at query time?
>>
>>
>>
>> On Tue, Apr 8, 2014 at 7:41 AM, Aman Tandon <amantandon...@gmail.com>wrote:
>>
>>> 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