tantivy backend: return tags in search results
This commit is contained in:
parent
bff48f35f4
commit
05a60af389
|
@ -202,14 +202,27 @@ impl Backend for TantivyBackend {
|
|||
let snippet = article_snippet_generator.snippet(&doc_row.body);
|
||||
let excerpt = snippet.to_html();
|
||||
|
||||
let tags = doc
|
||||
.get_all(self.fields.tags)
|
||||
.map(|fv| {
|
||||
String::from(
|
||||
*fv.as_facet()
|
||||
.expect("tags must be facet!")
|
||||
.to_path()
|
||||
.last()
|
||||
.unwrap_or(&""),
|
||||
)
|
||||
})
|
||||
.collect();
|
||||
|
||||
out.push(SearchDocument {
|
||||
score,
|
||||
title: doc_row.title,
|
||||
excerpt,
|
||||
tags: vec![],
|
||||
tags,
|
||||
url: url.to_owned(),
|
||||
favicon_url_hash: doc_row.favicon_url_hash,
|
||||
})
|
||||
});
|
||||
}
|
||||
|
||||
Ok(out)
|
||||
|
|
Loading…
Reference in New Issue