From fee95ccd6e8b9aec400f0fd04410e8fc68b6f2d0 Mon Sep 17 00:00:00 2001 From: Baitinq Date: Wed, 2 Nov 2022 21:40:08 +0100 Subject: Lib: Only care about url for Eq and Hash implementation in IndexedResource This fixes bugs with multiple word search not working as the IndexedResource.word are different and they are not considered to match. --- lib/src/lib.rs | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'lib') diff --git a/lib/src/lib.rs b/lib/src/lib.rs index 48bf92b..6966d3e 100644 --- a/lib/src/lib.rs +++ b/lib/src/lib.rs @@ -21,10 +21,10 @@ pub mod lib { //maybe in the future we need filetypes? } - //We implement PartialEq, Eq and Hash to ignore the priority field. + //We implement PartialEq, Eq and Hash to only care about the url field. impl PartialEq for IndexedResource { fn eq(&self, other: &Self) -> bool { - self.url == other.url && self.word == other.word + self.url == other.url } } impl Eq for IndexedResource {} @@ -44,8 +44,7 @@ pub mod lib { impl Hash for IndexedResource { fn hash(&self, state: &mut H) { - self.url.hash(state); - self.word.hash(state); + self.url.hash(state) } } } -- cgit 1.4.1