Bump heed to 0.10.4 to use be able to lazily decode roaring bitmaps

This commit is contained in:
Clément Renault 2020-11-19 15:53:13 +01:00
parent 59ca4b9fe4
commit 07a0c82790
No known key found for this signature in database
GPG Key ID: 92ADA4E935E71FA4
4 changed files with 13 additions and 9 deletions

4
Cargo.lock generated
View File

@ -378,9 +378,9 @@ dependencies = [
[[package]]
name = "heed"
version = "0.10.3"
version = "0.10.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8d2740ccbbfb2a6e6ff0c43e0fc14981ed668fb45be5a4e7b2bc03fc8cca3d3e"
checksum = "cddc0d0d20adfc803b3e57c2d84447e134cad636202e68e275c65e3cbe63c616"
dependencies = [
"byteorder",
"heed-traits",

View File

@ -14,7 +14,7 @@ flate2 = "1.0.17"
fst = "0.4.4"
fxhash = "0.2.1"
grenad = { git = "https://github.com/Kerollmops/grenad.git", rev = "3eb7ad9" }
heed = { version = "0.10.3", default-features = false, features = ["lmdb", "sync-read-txn"] }
heed = { version = "0.10.4", default-features = false, features = ["lmdb", "sync-read-txn"] }
human_format = "1.0.3"
jemallocator = "0.3.2"
levenshtein_automata = { version = "0.2.0", features = ["fst_automaton"] }

View File

@ -8,7 +8,7 @@ edition = "2018"
[dependencies]
anyhow = "1.0.28"
grenad = { git = "https://github.com/Kerollmops/grenad.git", rev = "3eb7ad9" }
heed = "0.10.3"
heed = "0.10.4"
memmap = "0.7.0"
milli = { path = ".." }
once_cell = "1.4.1"

View File

@ -280,8 +280,11 @@ impl<'a> Search<'a> {
Unbounded => Unbounded,
};
let right_bound = Included((field_id, level, T::max_value(), T::max_value()));
let db = self.index.facet_field_id_value_docids.remap_key_type::<KC>();
let iter = db
// We also make sure that we don't decode the data before we are sure we must return it.
let iter = self.index
.facet_field_id_value_docids
.remap_key_type::<KC>()
.lazily_decode_data()
.range(self.rtxn, &(left_bound, right_bound))?
.take_while(|r| r.as_ref().map_or(true, |((.., r), _)| {
match right {
@ -289,13 +292,14 @@ impl<'a> Search<'a> {
Excluded(right) => *r < right,
Unbounded => true,
}
}));
}))
.map(|r| r.and_then(|(key, lazy)| lazy.decode().map(|data| (key, data))));
debug!("Iterating between {:?} and {:?} (level {})", left, right, level);
for (i, result) in iter.enumerate() {
let ((_fid, _level, l, r), docids) = result?;
debug!("{:?} to {:?} (level {}) found {} documents", l, r, _level, docids.len());
let ((_fid, level, l, r), docids) = result?;
debug!("{:?} to {:?} (level {}) found {} documents", l, r, level, docids.len());
output.union_with(&docids);
// We save the leftest and rightest bounds we actually found at this level.
if i == 0 { left_found = Some(l); }