Couldn't get all the text for System-Wide search functionality using algolia-search-plugin with gatsby

11 views Asked by At

I aim to integrate a system-wide search feature into my project, utilizing Gatsby alongside Strapi. While experimenting with the Algolia search plugin, I encountered a limitation—it only retrieves data from markdown components. How can I extend this functionality to encompass all text across different components stored in my Strapi database?

I tried this

`const escapeStringRegexp = require("escape-string-regexp");

const pagePath = content; const indexName = Search;

const pageQuery = { pages: allMarkdownRemark { edges { node { id frontmatter { title } excerpt } } } };

function pageToAlgoliaRecord({ node: { id, frontmatter, excerpt } }) { return { objectID: id, ...frontmatter, excerpt }; }

const queries = [ { query: pageQuery, transformer: ({ data }) => data.pages.edges.map(pageToAlgoliaRecord), indexName, settings: { attributesToSnippet: [excerpt:5000] } } ];

module.exports = queries; `

0

There are 0 answers