From 73c06d31d973771d667ba40939db8f399061a5cb Mon Sep 17 00:00:00 2001 From: Louis Dureuil Date: Wed, 25 Oct 2023 16:50:49 +0200 Subject: [PATCH] snapshot always display stuff in consistent order --- milli/src/snapshot_tests.rs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/milli/src/snapshot_tests.rs b/milli/src/snapshot_tests.rs index 1d8d63277..730d0a5c8 100644 --- a/milli/src/snapshot_tests.rs +++ b/milli/src/snapshot_tests.rs @@ -333,6 +333,9 @@ pub fn snap_geo_faceted_documents_ids(index: &Index) -> String { pub fn snap_external_documents_ids(index: &Index) -> String { let rtxn = index.read_txn().unwrap(); let external_ids = index.external_documents_ids(&rtxn).unwrap().to_hash_map(); + // ensure fixed order (not guaranteed by hashmap) + let mut external_ids: Vec<(String, u32)> = external_ids.into_iter().collect(); + external_ids.sort_by(|(l, _), (r, _)| l.cmp(r)); let mut snap = String::new();