When the primary sort criteria is identical for two documents, then the _internal_ Lucene document ID is used to break the tie. The internal ID for two docs can be not only different, but in different _order_ on two separate shards. I'm assuming here that each of your shards has multiple replicas and/or you're continuing to index to your cluster.
The relative internal doc IDs for may change even relative to each other when segments get merged. So yes, if you are sorting by something that can be identical in documents, it's always best to specify a secondary sort criteria. It's not referenced unless there's a tie so it's not that expensive. People often use whatever field is defined for <uniqueKey> since that's _guaranteed_ to never be the same for two docs. Best, Erick On Wed, Sep 9, 2015 at 1:45 AM, Modassar Ather <modather1...@gmail.com> wrote: > Hi, > > Search results are changed every time the following query is hit. Please > note that it is 7 shard cluster of Solr-5.2.1. > > Query: q=network&start=50&rows=50&sort=f_sort asc&group=true&group.field=id > > Following are the fields and their types in my schema.xml. > > <fieldType name="string" class="solr.StrField" sortMissingLast="true" > stored="false" omitNorms="true"/> > <fieldType name="string_dv" class="solr.StrField" sortMissingLast="true" > stored="false" indexed="true" docValues="true"/> > > <field name="id" type="string" stored="true"/> > <dynamicField name="*_sort" type="string_dv"/> > > As per my understanding it seems to be the issue of tie among the document > as when I added a new sort field like below the result never changed across > multiple hits. > q=network&start=50&rows=50&sort=f_sort asc, score > asc&group=true&group.field=id > > Kindly let me know if this is an issue or how this can be fixed. > > Thanks, > Modassar