0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-02-24 23:48:13 -05:00

Extended search results to use real author and tags data

refs https://github.com/TryGhost/Team/issues/1665

- matches real author and tag data from search index to show results
This commit is contained in:
Rishabh 2022-07-06 12:28:36 +02:00
parent f1fbe1bf9a
commit 99f654192f

View file

@ -182,8 +182,8 @@ function TagResults({tags}) {
const TagItems = tags.map((d) => { const TagItems = tags.map((d) => {
return ( return (
<TagListItem <TagListItem
key={d.title} key={d.name}
title={d.title} title={d.name}
/> />
); );
}); });
@ -293,14 +293,9 @@ function SearchResultBox() {
if (indexComplete && searchValue) { if (indexComplete && searchValue) {
searchResults = searchIndex.search(searchValue); searchResults = searchIndex.search(searchValue);
filteredPosts = searchResults?.posts?.map((d) => { filteredPosts = searchResults?.posts || [];
return { filteredAuthors = searchResults?.authors || [];
id: d?.id, filteredTags = searchResults?.tags || [];
excerpt: d?.excerpt,
title: d?.title,
slug: d?.slug
};
}) || [];
} }
const hasResults = filteredPosts?.length || filteredAuthors?.length || filteredTags?.length; const hasResults = filteredPosts?.length || filteredAuthors?.length || filteredTags?.length;