Pass through excerpts to the frontend

This commit is contained in:
Olivier 'reivilibre' 2022-03-26 17:31:50 +00:00
parent 39ffdd1f1f
commit f4672181aa
2 changed files with 3 additions and 9 deletions

View File

@ -19,7 +19,7 @@ pub struct SearchResult {
pub favicon_url: String, pub favicon_url: String,
pub url: String, pub url: String,
pub title: String, pub title: String,
pub excerpt: Vec<ExcerptFragment>, pub excerpt: String,
pub tags: Vec<String>, pub tags: Vec<String>,
} }
@ -70,7 +70,7 @@ pub async fn search_search_inner(
favicon_url: "".to_string(), favicon_url: "".to_string(),
url: search_doc.url, url: search_doc.url,
title: search_doc.title, title: search_doc.title,
excerpt: vec![], // TODO excerpt: search_doc.excerpt,
tags: vec!["Software".to_owned(), "Blog".to_owned()], // TODO tags: vec!["Software".to_owned(), "Blog".to_owned()], // TODO
}) })
} }

View File

@ -29,13 +29,7 @@
<img src="{{ result.favicon_url }}"> <img src="{{ result.favicon_url }}">
<div class="result_title"><a href="{{ result.url }}" rel="nofollow noreferrer">{{ result.title }}</a></div> <div class="result_title"><a href="{{ result.url }}" rel="nofollow noreferrer">{{ result.title }}</a></div>
<div class="result_excerpt"> <div class="result_excerpt">
{%- for excerpt_chunk in result.excerpt -%} {{- result.excerpt -}}
{%- if excerpt_chunk.mark %}
<b>{{ excerpt_chunk.text }}</b>
{%- else %}
{{ excerpt_chunk.text }}
{%- endif -%}
{%- endfor -%}
</div> </div>
<ul class="result_tags"> <ul class="result_tags">
{%- for tag in result.tags -%} {%- for tag in result.tags -%}