From 6ae69d361c247431f72c384b764bb2190ac7928d Mon Sep 17 00:00:00 2001 From: Jason Gerlowski Date: Mon, 16 Mar 2020 07:59:25 -0400 Subject: [PATCH] Document sort param tiebreak logic (#1349) --- solr/solr-ref-guide/src/common-query-parameters.adoc | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/solr/solr-ref-guide/src/common-query-parameters.adoc b/solr/solr-ref-guide/src/common-query-parameters.adoc index d2915f4570b..1cfd3916853 100644 --- a/solr/solr-ref-guide/src/common-query-parameters.adoc +++ b/solr/solr-ref-guide/src/common-query-parameters.adoc @@ -63,7 +63,10 @@ Regarding the sort parameter's arguments: * A sort ordering must include a field name (or `score` as a pseudo field), followed by whitespace (escaped as + or `%20` in URL strings), followed by a sort direction (`asc` or `desc`). * Multiple sort orderings can be separated by a comma, using this syntax: `sort=+,+],...` -** When more than one sort criteria is provided, the second entry will only be used if the first entry results in a tie. If there is a third entry, it will only be used if the first AND second entries are tied. This pattern continues with further entries. +** When more than one sort criteria is provided, the second entry will only be used if the first entry results in a tie. If there is a third entry, it will only be used if the first AND second entries are tied. And so on. +** If documents tie in all of the explicit sort criteria, Solr uses each document's Lucene document ID as the final tie-breaker. +This internal property is subject to change during segment merges and document updates, which can lead to unexpected result ordering changes. +Users looking to avoid this behavior can add an additional sort criteria on a unique or rarely-shared field such as `id` to prevent ties from occurring (e.g. `price desc,id asc`). == start Parameter