Add more debug infos

This commit is contained in:
Clément Renault 2019-11-30 16:33:48 +01:00
parent ef6a4db182
commit d17d4dc5ec
No known key found for this signature in database
GPG key ID: 0151CDAB43460DAE
5 changed files with 39 additions and 408 deletions

View file

@ -7,6 +7,7 @@ use std::{cmp, fmt, vec};
use fst::{IntoStreamer, Streamer};
use levenshtein_automata::DFA;
use meilisearch_tokenizer::{is_cjk, split_query_string};
use log::debug;
use crate::database::MainT;
use crate::error::MResult;
@ -38,6 +39,10 @@ impl AutomatonProducer {
synonyms_store,
)?;
for (i, group) in automatons.iter().enumerate() {
debug!("all automatons: group {} automatons {:?}", i, group.automatons);
}
Ok((AutomatonProducer { automatons }, query_enhancer))
}
@ -80,7 +85,9 @@ pub struct Automaton {
impl fmt::Debug for Automaton {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.debug_struct("Automaton")
.field("index", &self.index)
.field("query", &self.query)
.field("is_prefix", &self.is_prefix)
.finish()
}
}

View file

@ -58,6 +58,7 @@ where
type Origin = usize;
type RealLength = usize;
#[derive(Debug)]
struct FakeIntervalTree {
intervals: Vec<(Range<usize>, (Origin, RealLength))>,
}
@ -154,6 +155,7 @@ impl<S: AsRef<str>> QueryEnhancerBuilder<'_, S> {
}
}
#[derive(Debug)]
pub struct QueryEnhancer {
origins: Vec<usize>,
real_to_origin: FakeIntervalTree,