web search done right
gracefully handle weird stackoverflow formatting and interrupted summarization
Mikkel Denkerc308170979ca
diff --git a/core/src/api/summarize.rs b/core/src/api/summarize.rsindex 28df66c4..1742b5f7 100644--- a/core/src/api/summarize.rs+++ b/core/src/api/summarize.rs@@ -38,7 +38,9 @@ pub struct SummarizeParams {fn summarize_blocking(iter: impl Iterator<Item = String>, tx: UnboundedSender<String>) {for tok in iter {- tx.send(tok).unwrap();+ if tx.send(tok).is_err() {+ break;+ }}}diff --git a/core/src/search_prettifier/stack_overflow.rs b/core/src/search_prettifier/stack_overflow.rsindex 23193671..25dc8eab 100644--- a/core/src/search_prettifier/stack_overflow.rs+++ b/core/src/search_prettifier/stack_overflow.rs@@ -77,9 +77,9 @@ fn parse_so_answer(let text: Vec<_> = text.many().into_iter()- .map(|prop| match prop {- Property::String(s) => CodeOrText::Text(s),- Property::Item(item) => parse_code(item).unwrap(),+ .filter_map(|prop| match prop {+ Property::String(s) => Some(CodeOrText::Text(s)),+ Property::Item(item) => parse_code(item),}).collect();