Just adding to the below--> If there is a field(say X) which is not populated 
and in the query I am not sorting on this particular field but on another field 
(say Y) still the result ordering would depend on X .

Infact in the below problem mentioned by Harsh making X as 
sortMissingLast="false" sortMissingFirst="false" solved the problem while in 
the query he was sorting on Y.  This seems a bit illogical.

Regards,
Shubham
________________________________________
From: Harshvardhan Ojha [harshvardhan.o...@makemytrip.com]
Sent: Tuesday, July 03, 2012 5:58 PM
To: solr-user@lucene.apache.org
Subject: RE: Problem with sorting solr docs

Hi,

I have added <field name="latlng" indexed="true" stored="true" 
sortMissingLast="false" sortMissingFirst="false"/> to my schema.xml, although I 
am searching on name field.
It seems to be working fine. What is its default behavior?

Regards
Harshvardhan Ojha

-----Original Message-----
From: Rafał Kuć [mailto:r....@solr.pl]
Sent: Tuesday, July 03, 2012 5:35 PM
To: solr-user@lucene.apache.org
Subject: Re: Problem with sorting solr docs

Hello!

But the latlng field is not taken into account when sorting with sort defined 
such as in your query. You only sort on the name field and only that field. You 
can also define Solr behavior when there is no value in the field, but adding 
sortMissingLast="true" or sortMissingFirst="true" to your type definition in 
the schema.xml file.

--
Regards,
 Rafał Kuć
 Sematext :: http://sematext.com/ :: Solr - Lucene - Nutch - ElasticSearch

> Hi,

> Thanks for reply.
> I want to sort my docs on name field, it is working well only if I have all 
> fields populated well.
> But my latlng field is optional, every doc will not have this value.
> So those docs are not getting sorted.

> Regards
> Harshvardhan Ojha

> -----Original Message-----
> From: Rafał Kuć [mailto:r....@solr.pl]
> Sent: Tuesday, July 03, 2012 5:24 PM
> To: solr-user@lucene.apache.org
> Subject: Re: Problem with sorting solr docs

> Hello!

> Your query suggests that you are sorting on the 'name' field instead
> of the latlng field (sort=name +asc).

> The question is what you are trying to achieve ? Do you want to sort
> your documents from a given geographical point ? If that's the case
> you may want to look here:
> http://wiki.apache.org/solr/SpatialSearch/
> and look at the possibility of sorting on the distance from a given point.

> --
> Regards,
>  Rafał Kuć
>  Sematext :: http://sematext.com/ :: Solr - Lucene - Nutch -
> ElasticSearch


> Hi,
>
> I have 260 docs which I want to sort on a single field latlng.
> <doc>
> <str name="id">1</str>
> <str name="name">Amphoe Khanom</str>
> <str name="latlng">1.0,1.0</str>
> </doc>
>
> My query is :
> http://localhost:8080/solr/select?q=*:*&sort=name +asc
>
> This query sorts all documents except those which doesn’t have latlng,
> and I can’t keep any default value for this field.
> My question is how can I sort all docs on latlng?
>
> Regards
> Harshvardhan Ojha  | Software Developer - Technology Development
>     |  MakeMyTrip.com, 243 SP Infocity, Udyog Vihar Phase 1, Gurgaon,
> Haryana - 122 016, India

> What's new?: Inspire - Discover an inspiring new way to plan and book travel 
> online.


> Office Map

> Facebook

> Twitter


>

Reply via email to