1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#[macro_use]
extern crate log;

#[macro_use]
extern crate scan_fmt;

#[macro_use]
extern crate maplit;

use std::collections::HashMap;

pub mod index_schema;
pub mod key2slot;
pub mod vql;
pub mod xapian_reader;
pub mod xapian_vql;

pub fn init_db_path() -> HashMap<String, String> {
    hashmap! { "base".to_owned() => "data/xapian-search-base".to_owned(), "system".to_owned()=>"data/xapian-search-system".to_owned(), "deleted".to_owned()=>"data/xapian-search-deleted".to_owned(), "az".to_owned()=>"data/xapian-search-az".to_owned() }
}

pub fn to_lower_and_replace_delimiters(src: &str) -> String {
    src.chars()
        .map(|x| match x {
            '-' => '_',
            ':' => '_',
            _ => x.to_ascii_lowercase(),
        })
        .collect()
}