From 73bf56810e786a89554b9197b8031d6b5a1e033f Mon Sep 17 00:00:00 2001 From: Tobie Morgan Hitchcock Date: Mon, 17 Oct 2022 23:05:35 +0100 Subject: [PATCH] Enable searching within Record IDs using the CONTAINS operator Closes #1377 --- lib/src/sql/value/value.rs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/src/sql/value/value.rs b/lib/src/sql/value/value.rs index 134f7131..f8c5b608 100644 --- a/lib/src/sql/value/value.rs +++ b/lib/src/sql/value/value.rs @@ -1044,6 +1044,10 @@ impl Value { pub fn contains(&self, other: &Value) -> bool { match self { Value::Array(v) => v.iter().any(|v| v.equal(other)), + Value::Thing(v) => match other { + Value::Strand(w) => v.to_string().contains(w.as_str()), + _ => v.to_string().contains(&other.to_string().as_str()), + }, Value::Strand(v) => match other { Value::Strand(w) => v.contains(w.as_str()), _ => v.contains(&other.to_string().as_str()),