Allow multi queries on same index
bidoubiwa opened this issue · comments
After #15, the config file will look like this. You will be able to create multiple indexes with each their own graphQL query.
{
"options" : {
host: '...'
// ...
indexes: [
{
indexUid: 'my_blog'
// ...
query: ` ... `
}
]
}
}
This implies that for every index
created in MeiliSearch you can provide one graphQL
query.
As this seems a bit limitated since you can have multiple page structures but you'd like to add them all in the same index, we want to change query
to queries
. That would accept an array of queries.
So instead of for example:
query: `
query MyQuery {
allMdx {
// ....
}
}
`,
It becomes:
queries: [`
query MyQuery {
allMdx {
// ....
}
}
`],
This changes the code here:
gatsby-plugin-meilisearch/gatsby-node.js
Lines 32 to 33 in b47111a
Where you will have to iterate on the queries to fetch all data.
Closing this as we can simply add an other object to indexes
to do the same thing 👍