mirror of
https://github.com/quickwit-oss/tantivy.git
synced 2026-05-16 16:20:40 +00:00
rustfmt
This commit is contained in:
committed by
Pascal Seitz
parent
af9b7985fd
commit
592b671c8c
@@ -827,14 +827,23 @@ fn build_term_ord_cache<TermMap: TermAggregationMap>(
|
||||
assert!(all_found);
|
||||
|
||||
let missing_key: Option<IntermediateKey> =
|
||||
term_req.req.missing.as_ref().map(|missing_value| match missing_value {
|
||||
Key::Str(s) => IntermediateKey::Str(s.clone()),
|
||||
Key::F64(v) => IntermediateKey::F64(*v),
|
||||
Key::U64(v) => IntermediateKey::U64(*v),
|
||||
Key::I64(v) => IntermediateKey::I64(*v),
|
||||
});
|
||||
term_req
|
||||
.req
|
||||
.missing
|
||||
.as_ref()
|
||||
.map(|missing_value| match missing_value {
|
||||
Key::Str(s) => IntermediateKey::Str(s.clone()),
|
||||
Key::F64(v) => IntermediateKey::F64(*v),
|
||||
Key::U64(v) => IntermediateKey::U64(*v),
|
||||
Key::I64(v) => IntermediateKey::I64(*v),
|
||||
});
|
||||
|
||||
Ok(TermOrdToStrCache::new(term_ords, string_refs, string_arena, missing_key))
|
||||
Ok(TermOrdToStrCache::new(
|
||||
term_ords,
|
||||
string_refs,
|
||||
string_arena,
|
||||
missing_key,
|
||||
))
|
||||
}
|
||||
|
||||
/// The collector puts values from the fast field into the correct buckets and does a conversion to
|
||||
@@ -1165,8 +1174,7 @@ where
|
||||
let intermediate_entry = intermediate_entry_it.next().unwrap();
|
||||
dict.insert(
|
||||
IntermediateKey::Str(
|
||||
String::from_utf8(term.to_vec())
|
||||
.expect("could not convert to String"),
|
||||
String::from_utf8(term.to_vec()).expect("could not convert to String"),
|
||||
),
|
||||
intermediate_entry,
|
||||
);
|
||||
@@ -3070,7 +3078,9 @@ mod tests {
|
||||
let inner_field = schema_builder.add_text_field("inner_term", STRING | FAST);
|
||||
let index = Index::create_in_ram(schema_builder.build());
|
||||
|
||||
let outer_values = (0..10_000).map(|i| format!("outer_{i}")).collect::<Vec<_>>();
|
||||
let outer_values = (0..10_000)
|
||||
.map(|i| format!("outer_{i}"))
|
||||
.collect::<Vec<_>>();
|
||||
let inner_values = ["INFO", "ERROR", "WARN", "DEBUG"];
|
||||
|
||||
{
|
||||
|
||||
@@ -41,12 +41,8 @@ pub(crate) struct TermOrdToStrCache {
|
||||
}
|
||||
|
||||
enum TermOrdToAddr {
|
||||
Dense {
|
||||
offsets: Vec<Option<StringRef>>,
|
||||
},
|
||||
Sparse {
|
||||
terms: FxHashMap<u64, StringRef>,
|
||||
},
|
||||
Dense { offsets: Vec<Option<StringRef>> },
|
||||
Sparse { terms: FxHashMap<u64, StringRef> },
|
||||
}
|
||||
|
||||
impl std::fmt::Debug for TermOrdToStrCache {
|
||||
@@ -100,8 +96,7 @@ impl TermOrdToStrCache {
|
||||
}
|
||||
TermOrdToAddr::Dense { offsets }
|
||||
} else {
|
||||
let terms: FxHashMap<u64, StringRef> =
|
||||
term_ords.into_iter().zip(string_refs).collect();
|
||||
let terms: FxHashMap<u64, StringRef> = term_ords.into_iter().zip(string_refs).collect();
|
||||
TermOrdToAddr::Sparse { terms }
|
||||
};
|
||||
|
||||
@@ -179,8 +174,7 @@ mod tests {
|
||||
|
||||
#[test]
|
||||
fn test_empty_cache() {
|
||||
let cache =
|
||||
TermOrdToStrCache::new(Vec::new(), Vec::new(), StringArena::default(), None);
|
||||
let cache = TermOrdToStrCache::new(Vec::new(), Vec::new(), StringArena::default(), None);
|
||||
assert_eq!(cache.get(0), None);
|
||||
assert_eq!(cache.get(100), None);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user