-
-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
caceb88
commit cd92b9f
Showing
8 changed files
with
62 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,21 @@ | ||
pub const CHARABIA: &str = "CHARABIA"; | ||
use once_cell::sync::Lazy; | ||
use tantivy::tokenizer::TextAnalyzer; | ||
|
||
#[cfg(feature = "charabia")] | ||
use super::charabia::CharabiaTokenizer; | ||
|
||
#[cfg(not(feature = "charabia"))] | ||
use tantivy::tokenizer::{LowerCaser, RemoveLongFilter, SimpleTokenizer}; | ||
|
||
pub const CUSTOM_TOKENIZER: &str = "CUSTOM_TOKENIZER"; | ||
|
||
pub const DEFAULT_TOKENIZER: Lazy<TextAnalyzer> = Lazy::new(|| { | ||
#[cfg(not(feature = "charabia"))] | ||
return TextAnalyzer::builder(SimpleTokenizer::default()) | ||
.filter(RemoveLongFilter::limit(40)) | ||
.filter(LowerCaser) | ||
.build(); | ||
|
||
#[cfg(feature = "charabia")] | ||
return CharabiaTokenizer::default().into(); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,13 @@ | ||
mod constants; | ||
mod index; | ||
mod schema; | ||
mod search; | ||
|
||
#[cfg(feature = "charabia")] | ||
mod constants; | ||
mod charabia; | ||
|
||
#[cfg(feature = "charabia")] | ||
mod tokenizer; | ||
pub use self::charabia::*; | ||
|
||
pub use self::index::*; | ||
pub use self::search::*; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters