9 unstable releases (4 breaking)

0.7.0 Jan 17, 2024
0.6.0 Aug 28, 2023
0.5.0 Jul 4, 2023
0.3.3 Mar 14, 2023
0.3.1 Dec 30, 2022

#220 in Database implementations

Download history 3/week @ 2024-07-21 23/week @ 2024-07-28 4/week @ 2024-09-22 4/week @ 2024-09-29

54 downloads per month

LGPL-2.1-only

14KB
118 lines

Crates.io License Open Source Love Rust

GitHub forks GitHub stars

tantivy-ik

ik-rs for Tantivy

Usage for Tantivy

Cargo.toml

[dependencies]
tantivy-ik = "0.7.0"

mod tests {
    use ik_rs::core::ik_segmenter::TokenMode;
    use ik_rs::IkTokenizer;
    use tantivy::Index;
    use tantivy::schema::{IndexRecordOption, Schema, TextFieldIndexing, TextOptions};

    #[test]
    fn it_works() {
        let mut schema_builder = Schema::builder();
        let text_field_indexing = TextFieldIndexing::default()
            .set_tokenizer("ik-index")
            .set_index_option(IndexRecordOption::WithFreqsAndPositions);
        let text_options = TextOptions::default()
            .set_indexing_options(text_field_indexing)
            .set_stored();
        schema_builder.add_text_field("title", text_options);
        let schema = schema_builder.build();
        let index = Index::create_in_ram(schema.clone());
        index
            .tokenizers()
            .register("ik-index", IkTokenizer::new(TokenMode::INDEX));
        index
            .tokenizers()
            .register("ik-search", IkTokenizer::new(TokenMode::SEARCH));
    }
}

Welcome rust developer and search engine developer join us, and maintain this project together!

you can PR or submit issue...

and star⭐️ or fork this project to support me!

Dependencies

~22–32MB
~449K SLoC