diff --git a/scripts/indexr.js b/scripts/indexr.js index 992ee62d..fbf1e9c6 100644 --- a/scripts/indexr.js +++ b/scripts/indexr.js @@ -29,7 +29,7 @@ const pageQuery = ` fields { slug } - excerpt(pruneLength: 6700) + excerpt(pruneLength: 100) } } } @@ -37,11 +37,16 @@ const pageQuery = ` `; function pageToTypesenseRecord({ node }) { - const { id, frontmatter, ...rest } = node; - console.log('node', node); + const { id, frontmatter, fields = {}, headings = [], ...rest } = node; + + const formattedHeadings = headings.map(h => h.value || '').filter(Boolean); return { objectID: id, - ...frontmatter, + title: frontmatter.title || '', + search_keyword: String(frontmatter.search_keyword || ''), + slug: fields.slug || '', + excerpt: frontmatter.excerpt || '', + headings: formattedHeadings, ...rest, }; } diff --git a/src/components/SearchHits.jsx b/src/components/SearchHits.jsx index 677e9975..f4e4c1ed 100644 --- a/src/components/SearchHits.jsx +++ b/src/components/SearchHits.jsx @@ -23,10 +23,10 @@ export const CustomSearchBox = connectSearchBox(SearchBox); /* eslint-disable react/no-danger */ const Hits = ({ hits }) => (