tantivy-jieba

Crates.iotantivy-jieba
lib.rstantivy-jieba
version0.11.0
sourcesrc
created_at2019-02-13 20:05:21.563709
updated_at2024-04-28 09:32:15.803819
descriptionA library that bridges between tantivy and jieba-rs
homepage
repositoryhttps://github.com/jiegec/tantivy-jieba
max_upload_size
id114610
size10,202
Chen (jiegec)

documentation

README

tantivy-jieba

Crates.io version docs.rs Changelog FOSSA Status

An adapter that bridges between tantivy and jieba-rs.

Usage

Add dependency tantivy-jieba to your Cargo.toml.

Example

use tantivy::tokenizer::*;
let mut tokenizer = tantivy_jieba::JiebaTokenizer {};
let mut token_stream = tokenizer.token_stream("测试");
assert_eq!(token_stream.next().unwrap().text, "测试");
assert!(token_stream.next().is_none());

Register tantivy tokenizer

use tantivy::schema::Schema;
use tantivy::tokenizer::*;
use tantivy::Index;
let tokenizer = tantivy_jieba::JiebaTokenizer {};
let index = Index::create_in_ram(schema);
index.tokenizers()
     .register("jieba", tokenizer);

License

FOSSA Status

Commit count: 39

cargo fmt