We had this happen with one-word queries that caused identical scores. Results fetched from different replicas could be in different order. Fixed it with a sort of “score, id”, where “id” was the unique ID field for the documents.
wunder Walter Underwood [email protected] http://observer.wunderwood.org/ (my blog) > On Dec 21, 2025, at 10:21 AM, Shaun Campbell <[email protected]> wrote: > > Thanks Andy. Very useful. Just checking my code though and it appears I > never sorted the sql select statement anyway, so I could never > guarantee the order of insertion and hence result display, although I don't > know why the database server would change its ordering. I'll check with the > dba. > > Shaun > > On Sun, 21 Dec 2025 at 17:14, Andy Webb <[email protected]> wrote: > >> hi Shaun - the default ordering is by Lucene document id - which _might_ >> tally with insertion order but I'm not sure. If that ordering is something >> you want to rely on I'd suggest adding a field whose value you control to >> use instead - we found it useful to include a last-resort sort on our own >> primary key field to ensure stability between clusters when comparing >> results. >> >> >> https://solr.apache.org/guide/solr/latest/query-guide/common-query-parameters.html#sort-parameter >> >> https://solr.apache.org/guide/solr/latest/query-guide/document-transformers.html#docid-docidaugmenterfactory >> >> HTH! >> Andy >> >> On Sun, 21 Dec 2025 at 16:37, Shaun Campbell <[email protected]> >> wrote: >> >>> Hi >>> >>> I'm just trying to answer a few questions that have been asked about an >>> upgrade from 7.4 to 9.10 I've just done, and one of the questions is why >>> are the records in a different order between the two applications. >>> >>> It turns out that my application in this case is just doing a simple >> search >>> on a single text field and every record found seems to have the same >> score >>> unsurprisingly. Now my default sort order in the application is >>> score/relevancy. So I thought that if all my scores were the same then >>> surely it would then return them in the order they were inserted into the >>> index, or does it? So I went into the Solr console and did a simple >> query >>> and the records returned were in a different order between the two >> systems >>> with no sort specified. So that would imply to me that the records have >>> been inserted into the index in a different order. >>> >>> The only thing I haven't checked yet is whether there is any sort order >> on >>> the data coming from SQL that I use to rebuild the index. I am running a >>> dual core set up as I only have some 14,000 records and I just delete and >>> recreate the index when I reindex. >>> >>> Can anyone explain what happens in this case when all the scores are the >>> same, and what the default ordering might be? >>> >>> PS this is not an issue when they pick to sort by say start date as they >>> have something to sort by. >>> >>
