This is an automated email from the ASF dual-hosted git repository. rnewson pushed a commit to branch improve-search-test in repository https://gitbox.apache.org/repos/asf/couchdb.git
commit 686a3a48324adf53a4f625f82078b8903db5d7f0 Author: Robert Newson <[email protected]> AuthorDate: Tue Oct 21 09:34:03 2025 +0100 improve search test --- test/elixir/test/partition_search_test.exs | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/test/elixir/test/partition_search_test.exs b/test/elixir/test/partition_search_test.exs index cc64e9791..9310e701d 100644 --- a/test/elixir/test/partition_search_test.exs +++ b/test/elixir/test/partition_search_test.exs @@ -190,10 +190,16 @@ defmodule PartitionSearchTest do create_ddoc(db_name) url = "/#{db_name}/_design/library/_search/books" + + # score order varies by Lucene version, so captured this order first. + resp = Couch.get(url, query: %{q: "some:field"}) + assert_on_status(resp, 200, "Failed to search on non-partitioned dbs without the limit.") + expected_ids = get_ids(resp) + + # Assert that the limit:3 results are the first 3 results from the unlimited search resp = Couch.get(url, query: %{q: "some:field", limit: 3}) assert_on_status(resp, 200, "Failed to search on non-partitioned dbs with the limit.") - ids = get_ids(resp) - assert Enum.sort(ids) == Enum.sort(["bar:1", "bar:5", "bar:9"]) + assert List.starts_with?(expected_ids, get_ids(resp)) end @tag :with_db
