Is there a way to search by a nested object value?
adamJLev opened this issue · 4 comments
For example like the author.name
example below.
I think this used to work in an earlier version... did it get removed?
thank you!
options: {
searchFields: ['title', 'description', 'author.name'],
collections: [
{
typeName: 'BlogPost',
indexName: 'BlogPost',
fields: ['title', 'description'],
},
],
},
@adamJLev I'm not sure that there is at the moment, I haven't yet added support for it. I'll look into that though.
I don't think that this plugin has ever supported searching in nested fields? It does support nested fields for the search result though.
I have a similar question. Search doesn't work for a nested object value content.text :-(
Search for 'title' works but not for 'content.text'
I'm using graphcms to store data.
gridsome settings:
{
use: 'gridsome-plugin-flexsearch',
options: {
searchFields: ['title', 'content'],
collections: [
{
indexName: 'Article',
query: `{ gcms { blogArticles { title, id, slug, articleImage { url }, content { text } } } }`,
path: 'gcms.blogArticles',
},
],
},
},
The official documentation has something about this -
https://github.com/nextapps-de/flexsearch#complex-objects
@adamJLev Does the above PR help with your usecase?
I've added the helper with PR #66 to the GraphQL source.