Move the FacetStringIter creation logic into a private new method

This commit is contained in:
Kerollmops 2021-08-17 10:29:43 +02:00
parent 51581d14f8
commit 01a4052828
No known key found for this signature in database
GPG Key ID: 92ADA4E935E71FA4

View File

@ -298,6 +298,16 @@ impl<'t> FacetStringIter<'t> {
index: &'t Index, index: &'t Index,
field_id: FieldId, field_id: FieldId,
documents_ids: RoaringBitmap, documents_ids: RoaringBitmap,
) -> heed::Result<FacetStringIter<'t>> {
FacetStringIter::new(rtxn, index, field_id, documents_ids, false)
}
fn new(
rtxn: &'t heed::RoTxn,
index: &'t Index,
field_id: FieldId,
documents_ids: RoaringBitmap,
must_reduce: bool,
) -> heed::Result<FacetStringIter<'t>> { ) -> heed::Result<FacetStringIter<'t>> {
let db = index.facet_id_string_docids.remap_types::<ByteSlice, ByteSlice>(); let db = index.facet_id_string_docids.remap_types::<ByteSlice, ByteSlice>();
let highest_level = Self::highest_level(rtxn, db, field_id)?.unwrap_or(0); let highest_level = Self::highest_level(rtxn, db, field_id)?.unwrap_or(0);
@ -324,7 +334,7 @@ impl<'t> FacetStringIter<'t> {
db, db,
field_id, field_id,
level_iters: vec![(documents_ids, highest_iter)], level_iters: vec![(documents_ids, highest_iter)],
must_reduce: false, must_reduce,
}) })
} }