Hi, to add to what Michael specified:
*"is determined by the order of docs asserialized in the Lucene index -- and that order is arbitrary, and can varyacross different replicas of the same "shard" of the index."* Until segment merge happens in the background, the internal Lucene ID for a document aligns with the order of indexing. So you may be tricked to rely on this property i.e. the final tie-breaker is the time of indexing. But updates, deletions, background merges(and potentially other internal mechanisms that I missed) happen all the time, so you should always be responsible for solving your score ties and never rely on the internal Lucene ID for a document to do that. Cheers -------------------------- Alessandro Benedetti Apache Lucene/Solr Committer Director, R&D Software Engineer, Search Consultant www.sease.io On Thu, 22 Jul 2021 at 17:35, Michael Gibney <[email protected]> wrote: > No sort option configured generally defaults to score (and currently does > so even in cases such as the "*:*" case (MatchAllDocsQuery) where sort is > guaranteed to be irrelevant; see: > https://issues.apache.org/jira/browse/SOLR-14765). > > But functionally speaking that doesn't really matter: in the event of a > main-sort "tie" (and in this case what you have is essentially "one big > tie") or no sort at all, the order is determined by the order of docs as > serialized in the Lucene index -- and that order is arbitrary, and can vary > across different replicas of the same "shard" of the index. > > If stability is desired (and in many cases it is), you could try adding a > default `sort` param of, e.g.: `sort=score,id` (with `id` as a unique, > explicit tie-breaker). There are other options for handling this situation > and nuances that you may want to account for somehow; but they all stem > from the direct answer to your question, which is that in the event of tie > or no sort, the order of returned results is arbitrary and unstable. > > On Thu, Jul 22, 2021 at 11:11 AM Steven White <[email protected]> > wrote: > > > I don't have any sort option configured. The score I'm getting back is > 1.0 > > for each hit item. > > > > Does anyone know about Lucene's internal functionality to help me > > understand what the returned order is? > > > > Steven > > > > On Wed, Jul 21, 2021 at 10:52 AM Vincenzo D'Amore <[email protected]> > > wrote: > > > > > if no sort options are configure, just try to add the score field > you'll > > > see all the documents (are ordered by score), which usually when there > > are > > > no clause is 1. > > > > > > On Wed, Jul 21, 2021 at 4:36 PM Steven White <[email protected]> > > wrote: > > > > > > > Hi everyone, > > > > > > > > When I search on "*" (asterisk character) what's the result sort > order > > > > based on? > > > > > > > > Thanks > > > > > > > > Steven > > > > > > > > > > > > > -- > > > Vincenzo D'Amore > > > > > >
