Skip to content

web search done right

if there is no cleantext on site, then we probably can't create a good snippet anyway

Mikkel Denker00bc05cfba32
diff --git a/core/src/snippet.rs b/core/src/snippet.rs
index db2523a9..c14b8863 100644
--- a/core/src/snippet.rs
+++ b/core/src/snippet.rs
@@ -231,6 +231,10 @@ pub fn generate(query: &Query, text: &str, region: &Region, config: SnippetConfi
None => whatlang::detect_lang(text).unwrap_or(Lang::Eng),
};
+ if text.is_empty() {
+ return text.to_string();
+ }
+
let snippet = snippet_string(text, query.simple_terms(), lang, config);
snippet.to_html()