Skip to content

Commit 0d267c1

Browse files
authored
Merge pull request #5708 from apache/improve-search-test
improve search test
2 parents a96e4ce + a660192 commit 0d267c1

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

test/elixir/test/partition_search_test.exs

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -190,10 +190,16 @@ defmodule PartitionSearchTest do
190190
create_ddoc(db_name)
191191

192192
url = "/#{db_name}/_design/library/_search/books"
193+
194+
# score order varies by Lucene version, so captured this order first.
195+
resp = Couch.get(url, query: %{q: "some:field"})
196+
assert_on_status(resp, 200, "Failed to search on non-partitioned dbs without the limit.")
197+
expected_ids = get_ids(resp)
198+
199+
# Assert that the limit:3 results are the first 3 results from the unlimited search
193200
resp = Couch.get(url, query: %{q: "some:field", limit: 3})
194201
assert_on_status(resp, 200, "Failed to search on non-partitioned dbs with the limit.")
195-
ids = get_ids(resp)
196-
assert Enum.sort(ids) == Enum.sort(["bar:1", "bar:5", "bar:9"])
202+
assert List.starts_with?(expected_ids, get_ids(resp))
197203
end
198204

199205
@tag :with_db

0 commit comments

Comments
 (0)