diff options
author | Baitinq <manuelpalenzuelamerino@gmail.com> | 2022-11-02 21:40:08 +0100 |
---|---|---|
committer | Baitinq <manuelpalenzuelamerino@gmail.com> | 2022-11-02 21:40:08 +0100 |
commit | fee95ccd6e8b9aec400f0fd04410e8fc68b6f2d0 (patch) | |
tree | 1393762ec37484e14b1d8bc7bd8a210b03524826 | |
parent | Lib+Indexer: Make IndexedResource title and description Optional (diff) | |
download | OSSE-fee95ccd6e8b9aec400f0fd04410e8fc68b6f2d0.tar.gz OSSE-fee95ccd6e8b9aec400f0fd04410e8fc68b6f2d0.tar.bz2 OSSE-fee95ccd6e8b9aec400f0fd04410e8fc68b6f2d0.zip |
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.
-rw-r--r-- | lib/src/lib.rs | 7 |
1 files changed, 3 insertions, 4 deletions
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<H: Hasher>(&self, state: &mut H) { - self.url.hash(state); - self.word.hash(state); + self.url.hash(state) } } } |