diff --git a/src/web/assets/index.html b/src/web/assets/index.html index 2557b10..dd5a625 100644 --- a/src/web/assets/index.html +++ b/src/web/assets/index.html @@ -1,21 +1,34 @@ - + - - - + + + metasearch - + - - - + + +
-

metasearch

-
- - -
+

metasearch

+
+ + +
- - \ No newline at end of file + + diff --git a/src/web/search.rs b/src/web/search.rs index ad6b8d3..66413bd 100644 --- a/src/web/search.rs +++ b/src/web/search.rs @@ -95,7 +95,7 @@ fn render_featured_snippet(featured_snippet: &engines::FeaturedSnippet) -> Strin fn render_results(response: Response) -> String { let mut html = String::new(); - if let Some(infobox) = response.infobox { + if let Some(infobox) = &response.infobox { html.push_str(&format!( r#"
{infobox_html}{engines_html}
"#, infobox_html = &infobox.html, @@ -103,19 +103,28 @@ fn render_results(response: Response) -> String { )); } - if let Some(answer) = response.answer { + if let Some(answer) = &response.answer { html.push_str(&format!( r#"
{answer_html}{engines_html}
"#, answer_html = &answer.html, engines_html = render_engine_list(&[answer.engine]) )); } - if let Some(featured_snippet) = response.featured_snippet { + if let Some(featured_snippet) = &response.featured_snippet { html.push_str(&render_featured_snippet(&featured_snippet)); } for result in &response.search_results { html.push_str(&render_search_result(result)); } + + if response.infobox.is_none() + && response.answer.is_none() + && response.featured_snippet.is_none() + && response.search_results.is_empty() + { + html.push_str(r#"

No results.

"#); + } + html }