mirror of
https://github.com/quickwit-oss/tantivy.git
synced 2026-10-08 04:42:41 +00:00
added comments
This commit is contained in:
@@ -114,6 +114,7 @@ impl Index {
|
||||
Index::create_from_metas(directory, &metas)
|
||||
}
|
||||
|
||||
/// Reads the index meta file from the directory.
|
||||
pub fn load_metas(&self) -> Result<IndexMeta> {
|
||||
load_metas(self.directory())
|
||||
}
|
||||
|
||||
@@ -42,6 +42,11 @@ impl Default for TextOptions {
|
||||
}
|
||||
}
|
||||
|
||||
/// Configuration defining indexing for a text field.
|
||||
/// It wraps:
|
||||
///
|
||||
/// * record (See [`IndexRecordOption`](./enum.IndexRecordOption.html))
|
||||
/// * tokenizer
|
||||
#[derive(Clone, PartialEq, Eq, Debug, Serialize, Deserialize)]
|
||||
pub struct TextFieldIndexing {
|
||||
record: IndexRecordOption,
|
||||
|
||||
@@ -3,6 +3,7 @@ use super::{Token, TokenFilter, TokenStream};
|
||||
use rust_stemmers::{self, Algorithm};
|
||||
|
||||
/// `Stemmer` token filter. Currently only English is supported.
|
||||
/// Tokens are expected to be lowercased beforehands.
|
||||
#[derive(Clone)]
|
||||
pub struct Stemmer {
|
||||
stemmer_algorithm: Arc<Algorithm>,
|
||||
|
||||
@@ -253,7 +253,10 @@ where
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// Trait for the pluggable components of `Tokenizer`s.
|
||||
pub trait TokenFilter<TailTokenStream: TokenStream>: Clone {
|
||||
/// The resulting `TokenStream` type.
|
||||
type ResultTokenStream: TokenStream;
|
||||
|
||||
/// Wraps a token stream and returns the modified one.
|
||||
|
||||
@@ -28,6 +28,7 @@ pub struct TokenizerManager {
|
||||
}
|
||||
|
||||
impl TokenizerManager {
|
||||
/// Registers a new tokenizer associated with a given name.
|
||||
pub fn register<A>(&self, tokenizer_name: &str, tokenizer: A)
|
||||
where
|
||||
A: 'static + Send + Sync + for<'a> Tokenizer<'a>,
|
||||
@@ -39,6 +40,7 @@ impl TokenizerManager {
|
||||
.insert(tokenizer_name.to_string(), boxed_tokenizer);
|
||||
}
|
||||
|
||||
/// Accessing a tokenizer given its name.
|
||||
pub fn get(&self, tokenizer_name: &str) -> Option<Box<BoxedTokenizer>> {
|
||||
self.tokenizers
|
||||
.read()
|
||||
|
||||
Reference in New Issue
Block a user