sqlite-simple-tokenizer 0.6.0

This's a run-time loadable extension of SQLite fts5, supports Chinese and pinyin word segmentation and search.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
use std::env;

pub fn to_rusqlite_error(error: crate::Error) -> rusqlite::Error {
    rusqlite::Error::UserFunctionError(format!("{error:?}").into())
}

pub fn init_logging(default_level: log::LevelFilter) {
    const LOG_LEVEL_ENV: &str = "SQLITE_SIMPLE_TOKENIZER_LOG";

    if env::var(LOG_LEVEL_ENV).is_err() {
        unsafe { env::set_var(LOG_LEVEL_ENV, default_level.to_string()) }
    }

    let logger_level = env_logger::Env::new().filter(LOG_LEVEL_ENV);

    env_logger::try_init_from_env(logger_level).ok();
}