travis-r6s / gridsome-plugin-flexsearch

Add lightning fast search to Gridsome with FlexSearch

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

How to make it work with Contentful Source

opened this issue · comments

First of all thank you for this great plugin!

Can you tell me how to make it work with Contentful Source?

Hey @jrpersico-spurred, you should be able to use it as per the readme, you just need to configure the correct types to add; you can see available types by checking the GraphQL explorer. For example, you may have ContentfulPost, which you would then configure like so:

{
	use: 'gridsome-plugin-flexsearch',
	options: {
		searchFields: ['title'],
        collections: [
          {
            typeName: 'ContentfulPost',
            indexName: 'Post',
            fields: ['title', 'handle', 'description']
          }
        ]
  	}
}

Thank you for your reply.

I had misunderstood how to set indexName and typeName.