fix: clippy warnings in CodeSearchSchema

refactor-extract-code
Meng Zhang 2023-11-10 11:48:52 -08:00
parent 27ed9c2cc4
commit 3600ef77fc
1 changed files with 8 additions and 2 deletions

View File

@ -5,8 +5,8 @@ use tantivy::{
Index, Term,
};
pub static CODE_TOKENIZER: &str = "code";
pub static IDENTIFIER_TOKENIZER: &str = "identifier";
static CODE_TOKENIZER: &str = "code";
static IDENTIFIER_TOKENIZER: &str = "identifier";
pub fn register_tokenizers(index: &Index) {
let code_tokenizer = TextAnalyzer::builder(RegexTokenizer::new(r"(?:\w+)").unwrap())
@ -71,6 +71,12 @@ impl CodeSearchSchema {
}
}
impl Default for CodeSearchSchema {
fn default() -> Self {
Self::new()
}
}
impl CodeSearchSchema {
pub fn language_query(&self, language: &str) -> Box<TermQuery> {
Box::new(TermQuery::new(