Problem configuring FlexSearch
ramsesgarate opened this issue · comments
I am trying to configure the plugin in my project Repo ramsesgarate.com.
I just installed the plugin, set it up following the prompts:
{
use: 'gridsome-plugin-flexsearch',
options: {
flexsearch: {
cache: true,
profile: 'match'
},
searchFields: ['title', 'tags'],
collections: [{
typeName: 'Post',
indexName: 'Post',
fields: ['title', 'description']
}, ]
}
}
And I'm testing it in a view like so:
<template>
<Layout>
<input
id="search"
v-model="searchTerm"
class="input"
type="text"
placeholder="Search">
{{ searchResults }}
</Layout>
</template>
<script>
export default {
data: () => ({
searchTerm: ''
}),
computed: {
searchResults () {
const searchTerm = this.searchTerm
if (searchTerm.length < 3) return []
return this.$search.search({ query: searchTerm, limit: 5 })
},
test() {
return this.$search();
}
},
watch: {
$route (to, from) {
this.searchTerm = ''
}
}
}
</script>
When I run the gridsome develop
command I get the following error:
TypeError: Object.fromEntries is not a function
at collectionStore.data.map.node (C:\Users\AWTO\projects\ramsesgarate\node_modules\gridsome-plugin-flexsearch\gridsome.server.js:72:26)
at Array.map (<anonymous>)
at getStoreCollection (C:\Users\AWTO\projects\ramsesgarate\node_modules\gridsome-plugin-flexsearch\gridsome.server.js:56:35)
at collection (C:\Users\AWTO\projects\ramsesgarate\node_modules\gridsome-plugin-flexsearch\gridsome.server.js:122:14)
at C:\Users\AWTO\projects\ramsesgarate\node_modules\gridsome-plugin-flexsearch\node_modules\p-map\index.js:57:28
I can't find what the error may be, could you guide me, thanks.
@ramsesgarate You will need to use Node version that is >=12.x
.
Thanks man