This is an automated email from the ASF dual-hosted git repository. rnewson pushed a commit to branch score-order-fix in repository https://gitbox.apache.org/repos/asf/couchdb.git
commit 6500e2b225bb0045d36c1ba5849e466e01cb8c1a Author: Robert Newson <[email protected]> AuthorDate: Fri Nov 7 23:06:33 2025 +0000 default order should be highest score first fixes: https://github.com/apache/couchdb/discussions/5736 --- src/nouveau/src/nouveau_fabric_search.erl | 4 ++-- test/elixir/test/nouveau_test.exs | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/nouveau/src/nouveau_fabric_search.erl b/src/nouveau/src/nouveau_fabric_search.erl index 3ec9d96fd..bafe29059 100644 --- a/src/nouveau/src/nouveau_fabric_search.erl +++ b/src/nouveau/src/nouveau_fabric_search.erl @@ -201,9 +201,9 @@ merge_fun(Sort) -> compare_order(null, [A | ARest], [B | BRest]) -> case couch_ejson_compare:less(convert_item(A), convert_item(B)) of 0 -> - compare_order(null, ARest, BRest); + compare_order([], ARest, BRest); Less -> - Less < 1 + Less >= 1 end; %% server-side adds _id on the end of sort order if not present compare_order([], [A], [B]) -> diff --git a/test/elixir/test/nouveau_test.exs b/test/elixir/test/nouveau_test.exs index 36426d999..0b53a082c 100644 --- a/test/elixir/test/nouveau_test.exs +++ b/test/elixir/test/nouveau_test.exs @@ -434,7 +434,7 @@ defmodule NouveauTest do resp = Couch.post(url, body: %{selector: %{"$text": "hello"}}) assert_status_code(resp, 200) ids = get_mango_ids(resp) - assert ids == ["doc4", "doc3"] + assert ids == ["doc3", "doc4"] end @tag :with_db
