Fix compiler warning/errors caused by previous merge

This commit is contained in:
Loïc Lecrenier 2023-04-12 16:53:11 +02:00
parent df0d9bb878
commit 30f7bd03f6
3 changed files with 15 additions and 15 deletions

View File

@ -9,6 +9,7 @@ use roaring::RoaringBitmap;
use super::interner::Interned;
use super::Word;
use crate::heed_codec::StrBEU16Codec;
use crate::{
CboRoaringBitmapCodec, CboRoaringBitmapLenCodec, Result, RoaringBitmapCodec, SearchContext,
};
@ -292,14 +293,16 @@ impl<'ctx> SearchContext<'ctx> {
&mut self,
word_prefix: Interned<String>,
fid: u16,
) -> Result<Option<&'ctx [u8]>> {
) -> Result<Option<RoaringBitmap>> {
DatabaseCache::get_value(
self.txn,
(word_prefix, fid),
&(self.word_interner.get(word_prefix).as_str(), fid),
&mut self.db_cache.word_prefix_fid_docids,
self.index.word_prefix_fid_docids.remap_data_type::<ByteSlice>(),
)
)?
.map(|bytes| CboRoaringBitmapCodec::bytes_decode(bytes).ok_or(heed::Error::Decoding.into()))
.transpose()
}
pub fn get_db_word_fids(&mut self, word: Interned<String>) -> Result<Vec<u16>> {

View File

@ -4,9 +4,7 @@ use roaring::RoaringBitmap;
use super::{ComputedCondition, RankingRuleGraphTrait};
use crate::search::new::interner::{DedupInterner, Interned};
use crate::search::new::query_term::LocatedQueryTermSubset;
use crate::search::new::resolve_query_graph::{
compute_query_term_subset_docids, compute_query_term_subset_docids_within_field_id,
};
use crate::search::new::resolve_query_graph::compute_query_term_subset_docids_within_field_id;
use crate::search::new::SearchContext;
use crate::Result;
@ -53,7 +51,7 @@ impl RankingRuleGraphTrait for AttributeGraph {
let mut all_fields = FxHashSet::default();
for word in term.term_subset.all_single_words_except_prefix_db(ctx)? {
let fields = ctx.get_db_word_fids(word)?;
let fields = ctx.get_db_word_fids(word.interned())?;
all_fields.extend(fields);
}
@ -65,7 +63,7 @@ impl RankingRuleGraphTrait for AttributeGraph {
}
if let Some(word_prefix) = term.term_subset.use_prefix_db(ctx) {
let fields = ctx.get_db_word_prefix_fids(word_prefix)?;
let fields = ctx.get_db_word_prefix_fids(word_prefix.interned())?;
all_fields.extend(fields);
}

View File

@ -63,25 +63,24 @@ pub fn compute_query_term_subset_docids_within_field_id(
let mut docids = RoaringBitmap::new();
for word in term.all_single_words_except_prefix_db(ctx)? {
if let Some(word_fid_docids) = ctx.get_db_word_fid_docids(word, fid)? {
docids |= CboRoaringBitmapCodec::bytes_decode(word_fid_docids)
.ok_or(heed::Error::Decoding)?;
if let Some(word_fid_docids) = ctx.get_db_word_fid_docids(word.interned(), fid)? {
docids |= word_fid_docids;
}
}
for phrase in term.all_phrases(ctx)? {
for &word in phrase.words(ctx).iter().flatten() {
if let Some(word_fid_docids) = ctx.get_db_word_fid_docids(word, fid)? {
docids |= CboRoaringBitmapCodec::bytes_decode(word_fid_docids)
.ok_or(heed::Error::Decoding)?;
docids |= word_fid_docids;
}
}
}
if let Some(word_prefix) = term.use_prefix_db(ctx) {
if let Some(word_fid_docids) = ctx.get_db_word_prefix_fid_docids(word_prefix, fid)? {
docids |= CboRoaringBitmapCodec::bytes_decode(word_fid_docids)
.ok_or(heed::Error::Decoding)?;
if let Some(word_fid_docids) =
ctx.get_db_word_prefix_fid_docids(word_prefix.interned(), fid)?
{
docids |= word_fid_docids;
}
}