Fix search and make some minor improvements

This commit is contained in:
Olivier 'reivilibre' 2022-03-25 19:32:45 +00:00
parent 3a6f2fdf7a
commit 9c7dfb93f1
5 changed files with 14 additions and 5 deletions

1
Cargo.lock generated
View File

@ -3488,6 +3488,7 @@ dependencies = [
"serde_json",
"tokio",
"toml",
"zstd",
]
[[package]]

View File

@ -87,6 +87,7 @@ impl TantivyBackend {
// Open a libMDBX environment
let env = Env::open(&dir_path.join("store.mdbx"))?;
// TODO use a dictionary for the compression
let tables = StoreTables {
documents: env.open_wrapped_table(
Some("documents"),

View File

@ -17,6 +17,9 @@ toml = "0.5.8"
clap = { version = "3.1.6", features = ["derive"] }
colour = "0.6.0"
# For decompression of emitted packs. 0.11.1+zstd.1.5.2
zstd = "0.11.1"
quickpeep_densedoc = { path = "../quickpeep_densedoc" }
quickpeep_index = { path = "../quickpeep_index" }
quickpeep_structs = { path = "../quickpeep_structs" }

View File

@ -1,6 +1,6 @@
use anyhow::Context;
use clap::Parser;
use colour::{grey_ln, yellow_ln};
use colour::{dark_grey_ln, grey_ln, yellow_ln};
use env_logger::Env;
use quickpeep_indexer::config::IndexerConfig;
@ -17,8 +17,10 @@ pub struct Opts {
}
pub fn main() -> anyhow::Result<()> {
env_logger::Builder::from_env(Env::default().default_filter_or("info,qp_index_search=debug"))
.init();
env_logger::Builder::from_env(
Env::default().default_filter_or("info,tantivy=warn,qp_index_search=debug"),
)
.init();
let opts: Opts = Opts::parse();
@ -33,7 +35,7 @@ pub fn main() -> anyhow::Result<()> {
for result in results {
yellow_ln!("{}", result.title);
grey_ln!("\t[{:.3}] {}", result.score, result.url);
dark_grey_ln!("\t[{:.3}] {}", result.score, result.url);
// TODO Excerpts
println!();
}

View File

@ -37,7 +37,9 @@ pub fn main() -> anyhow::Result<()> {
yellow_ln!("{:?}", pack);
let file = File::open(&pack)?;
let mut buf_reader = BufReader::new(file);
let decompressor = zstd::stream::Decoder::new(file)?;
// TODO the decompressor has a buffer already, but we need this to see the end
let mut buf_reader = BufReader::new(decompressor);
let schema: String = serde_bare::from_reader(&mut buf_reader)?;
if &schema != SCHEMA_RAKED_PAGES {
bail!(