fix: trim the sanitized text to skip empty queries. (#573)

dedup-snippet-at-index
Meng Zhang 2023-10-16 17:45:49 -07:00 committed by GitHub
parent 98761c2a79
commit 2060d47a95
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 0 deletions

View File

@ -107,7 +107,9 @@ fn build_prefix(language: &str, prefix: &str, snippets: &[Snippet]) -> String {
fn collect_snippets(index_server: &IndexServer, language: &str, text: &str) -> Vec<Snippet> {
let mut ret = Vec::new();
let tokens = tokenize_text(text);
let sanitized_text = tokens.join(" ");
let sanitized_text = sanitized_text.trim();
if sanitized_text.is_empty() {
return ret;
}