From d4fa014534d0ed9740936a82b5fcae8013a83f71 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Antoine=20B=C3=BCsch?= Date: Wed, 5 Jun 2024 11:47:36 +1000 Subject: [PATCH] Make `query xml` return nodes in document order (#13047) # Description `query xml` used to return results from an XPath query in a random, non-deterministic order. With this change, results get returned in the order they appear in the document. # User-Facing Changes `query xml` will now return results in a non-random order. # Tests + Formatting - :green_circle: `toolkit fmt` - :green_circle: `toolkit clippy` - :green_circle: `toolkit test` - :green_circle: `toolkit test stdlib` # After Submitting --- crates/nu_plugin_query/src/query_xml.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crates/nu_plugin_query/src/query_xml.rs b/crates/nu_plugin_query/src/query_xml.rs index 3cbd9d6092..09bbde13df 100644 --- a/crates/nu_plugin_query/src/query_xml.rs +++ b/crates/nu_plugin_query/src/query_xml.rs @@ -88,7 +88,7 @@ pub fn execute_xpath_query( match r { sxd_xpath::Value::Nodeset(ns) => { - for n in ns.into_iter() { + for n in ns.document_order() { record.push(key.clone(), Value::string(n.string_value(), call.head)); } }