Closed darrylmorley closed 4 years ago
Is that array the exact result you get from your search results? As you can see, it is actually a string - note the "
either side of the array. So when you do [0]
, it selects the first character.
I'll have a look into this, as to why it isn't parsing the array properly. Could you paste your flexsearch config here please?
Ahh yes I see, so it is. My config is:
{
use: "gridsome-plugin-flexsearch",
options: {
collections: [
{
typeName: "Guns",
indexName: "Guns",
fields: [
"title",
"slug",
"images",
"price",
"mechanism",
"id",
"variant",
"condition",
"calibre"
]
}
],
searchFields: ["title", "mechanism", "calibre"]
}
}
When I log out options on build, the array is not a string.
images: [
{
Number: 1,
FullPath: 'https://images.guntrader.uk/GunImages/20/2003/20030/200303114752001/200303114752001-1.jpg',
ThumbPath: 'https://images.guntrader.uk/GunImages/Thumbnails/200303114752001-1-120x120.jpg'
},
I have fixed this in a new version (which includes a number of updates), but am awaiting for a PR in Gridsome. For now you could just do JSON.parse(<result>.images)
which will return the array.
Thanks for your help, I'm still seeing the same issue here though (using the updated plugin).
Yes, sorry - I haven't actually released the update yet...
Ha, I ran an update which upgraded your plugin I figured you had released it. Sorry.
Hi,
I have a really weird issue. I have the below available in my searchResults array.
When I try to select an image to display in my search results, it selects the characters rather than the url. I have
<g-image :src="`${result.images[0].FullPath}`" :alt="`${result.title}`" />
to select my image, this returns undefined. If I change this a little to<g-image :src="`${result.images[0]}`" :alt="`${result.title}`" />
I receive "[".I am getting characters instead of the object?