From 7b26bd88c0e1c18db3fc137715a8db8bc49e3a86 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Renault?= Date: Thu, 10 Oct 2019 13:09:29 +0200 Subject: [PATCH] Improve the DocumentsIdsIter internal --- meilidb-core/examples/from_file.rs | 2 +- meilidb-core/src/store/documents_fields.rs | 5 ++--- meilidb-core/src/store/mod.rs | 2 +- 3 files changed, 4 insertions(+), 5 deletions(-) diff --git a/meilidb-core/examples/from_file.rs b/meilidb-core/examples/from_file.rs index ec40e13b9..a13db568c 100644 --- a/meilidb-core/examples/from_file.rs +++ b/meilidb-core/examples/from_file.rs @@ -307,7 +307,7 @@ fn search_command(command: SearchCommand, database: Database) -> Result<(), Box< doc.highlights.sort_unstable_by_key(|m| (m.char_index, m.char_length)); let start_retrieve = Instant::now(); - let result = index.document::(&reader, Some(&fields), doc.id); + let result = index.document::<_, Document>(&reader, Some(&fields), doc.id); retrieve_duration += start_retrieve.elapsed(); match result { diff --git a/meilidb-core/src/store/documents_fields.rs b/meilidb-core/src/store/documents_fields.rs index a8e489f24..b3f5915cc 100644 --- a/meilidb-core/src/store/documents_fields.rs +++ b/meilidb-core/src/store/documents_fields.rs @@ -146,15 +146,14 @@ impl<'r> Iterator for DocumentsIdsIter<'r> { fn next(&mut self) -> Option { for result in self.iter.next() { match result { - Ok((key, Some(rkv::Value::Blob(bytes)))) => { + Ok((key, _)) => { let array = TryFrom::try_from(key).unwrap(); - let (document_id, attr) = document_attribute_from_key(array); + let (document_id, _) = document_attribute_from_key(array); if Some(document_id) != self.last_seen_id { self.last_seen_id = Some(document_id); return Some(Ok(document_id)) } }, - Ok((key, data)) => panic!("{:?}, {:?}", key, data), Err(e) => return Some(Err(e)), } } diff --git a/meilidb-core/src/store/mod.rs b/meilidb-core/src/store/mod.rs index 62f28a851..b8cb947ee 100644 --- a/meilidb-core/src/store/mod.rs +++ b/meilidb-core/src/store/mod.rs @@ -66,7 +66,7 @@ pub struct Index { } impl Index { - pub fn document( + pub fn document( &self, reader: &R, attributes: Option<&HashSet<&str>>,