diff --git a/Cargo.lock b/Cargo.lock index d6f04af9a..b3b23f02d 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1227,7 +1227,7 @@ checksum = "2839e79665f131bdb5782e51f2c6c9599c133c6098982a54c794358bf432529c" [[package]] name = "oxidized-mtbl" version = "0.1.0" -source = "git+https://github.com/Kerollmops/oxidized-mtbl.git?rev=5426182#5426182d9ad8b74a9ebb386f03d33ce073cef0e0" +source = "git+https://github.com/Kerollmops/oxidized-mtbl.git?rev=9bf47a7#9bf47a7d4f17dd45d395f12874291e00b2eadf40" dependencies = [ "byteorder", "crc32c", diff --git a/Cargo.toml b/Cargo.toml index 89e87599b..dbf77d00b 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -22,7 +22,7 @@ levenshtein_automata = { version = "0.2.0", features = ["fst_automaton"] } memmap = "0.7.0" near-proximity = { git = "https://github.com/Kerollmops/plane-sweep-proximity", rev = "6608205" } once_cell = "1.4.0" -oxidized-mtbl = { git = "https://github.com/Kerollmops/oxidized-mtbl.git", rev = "5426182" } +oxidized-mtbl = { git = "https://github.com/Kerollmops/oxidized-mtbl.git", rev = "9bf47a7" } rayon = "1.3.1" ringtail = "0.3.0" roaring = "0.6.0" diff --git a/src/bin/indexer.rs b/src/bin/indexer.rs index ae67abd99..e2f6c012c 100644 --- a/src/bin/indexer.rs +++ b/src/bin/indexer.rs @@ -34,9 +34,10 @@ const MAX_ATTRIBUTES: usize = u32::max_value() as usize / MAX_POSITION; const HEADERS_KEY: &[u8] = b"\0headers"; const DOCUMENTS_IDS_KEY: &[u8] = b"\x04documents-ids"; const WORDS_FST_KEY: &[u8] = b"\x06words-fst"; -const DOCUMENTS_IDS_BYTE: u8 = 4; -const WORD_DOCIDS_BYTE: u8 = 2; +const HEADERS_BYTE: u8 = 0; const WORD_DOCID_POSITIONS_BYTE: u8 = 1; +const WORD_DOCIDS_BYTE: u8 = 2; +const DOCUMENTS_IDS_BYTE: u8 = 4; #[cfg(target_os = "linux")] #[global_allocator] @@ -302,12 +303,8 @@ fn merge(key: &[u8], values: &[Vec]) -> Result, ()> { build.extend_stream(op.into_stream()).unwrap(); Ok(build.into_inner().unwrap()) }, - HEADERS_KEY => { - assert!(values.windows(2).all(|vs| vs[0] == vs[1])); - Ok(values[0].to_vec()) - }, key => match key[0] { - WORD_DOCID_POSITIONS_BYTE => { + HEADERS_BYTE | WORD_DOCID_POSITIONS_BYTE => { assert!(values.windows(2).all(|vs| vs[0] == vs[1])); Ok(values[0].to_vec()) },