added comments

This commit is contained in:
Paul Masurel
2018-01-04 12:53:20 +09:00
parent cb11b92505
commit 49519c3f61
5 changed files with 12 additions and 0 deletions
+1
View File
@@ -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())
}
+5
View File
@@ -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,
+1
View File
@@ -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>,
+3
View File
@@ -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.
+2
View File
@@ -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()