Comments (12)
@dylanpinn Very helpful!
In my case, when using the gatsby-source-drupal plugin, my working gatsby-config.js looks like this:
{
resolve: `@gatsby-contrib/gatsby-plugin-elasticlunr-search`,
options: {
fields: [`title`],
resolvers: {
node__topic: {
title: node => node.title,
path: node => node.path.alias,
},
},
},
},
The resolver for content is node__content_type_name
. In my case I have a Drupal content type called topic
.
Thanks again!
from gatsby-plugin-elasticlunr-search.
@seanngpack Here is our config. It works though I am still not 100% finished with it yet.
{
resolve: `@gatsby-contrib/gatsby-plugin-elasticlunr-search`,
options: {
fields: ['title', 'content'],
resolvers: {
wordpress__POST: {
title: node => node.title,
link: node => node.link,
filter: () => 'page-content',
},
wordpress__PAGE: {
title: node => node.title,
content: node => {
return node;
},
link: node => node.link,
filter: () => 'page-content',
},
wordpress__wp_document: {
title: node => node.title,
link: node => node.link,
filter: () => 'document',
},
},
},
},
from gatsby-plugin-elasticlunr-search.
For those that come here searching for a solution to this. It appears that a fork has been created for V2 https://github.com/gatsby-contrib/gatsby-plugin-elasticlunr-search.
This fixes the issue for me.
from gatsby-plugin-elasticlunr-search.
@dw235 I can't remember exactly but it was probably logging out all of the results from using the onCreateNode
API (https://www.gatsbyjs.org/docs/node-apis/#onCreateNode) in my gatsby-node.js
.
Easiest way I found to do this was to output the build results to a file which was easier to search through: gatsby build > output.log
etc.
from gatsby-plugin-elasticlunr-search.
I'm still having the same issue @devinswett, the siteSearchIndex doesn't seem to be created. Maybe it's an issue with how the gatsby-config is set up?
from gatsby-plugin-elasticlunr-search.
@dylanpinn Hey, can you post your gatsby-config? The nodes are not being generated for me and I'm using the forked version and Gatsby V2.
resolve: `@gatsby-contrib/gatsby-plugin-elasticlunr-search`,
options: {
// Fields to index
fields: [`title`,],
// How to resolve each field`s value for a supported node type
resolvers: {
// For any node of type MarkdownRemark, list how to resolve the fields` values
wordpressPost: {
title: node => node.title,
// path: node => node.slug,
// tags: node => node.tags,
// keywords: node => node.acf.keywords,
},
},
},
},
from gatsby-plugin-elasticlunr-search.
@dylanpinn OHHHHH, I was using the wrong resolvers. Thank you!
from gatsby-plugin-elasticlunr-search.
Hi @dylanpinn @seanngpack i am facing the similar issue Actually i am dynamically creating the pages by reading the content from excel sheet using gatsby-source-filesystem and gatsby-transformer-excel and i want to use @gatsby-contrib/gatsby-plugin-elasticlunr-search for search on the nodes created from the excel data. But i am getting the error message in graphiql "Cannot query field "siteSearchIndex" on type "RootQueryType".". Need your help in understanding what i am doing wrong here. Thanks in advance.
Details:
Plugins:
{
resolve: `gatsby-source-filesystem`,
options: {
path: `${__dirname}/src/pages`,
name: "pages",
},
},
{
resolve: `gatsby-source-filesystem`,
options: {
name: `data`,
path: `${__dirname}/src/data/`,
ignore: [`**/\.*`], // ignore files starting with a dot
},
},
`gatsby-transformer-excel`,
{
resolve: `gatsby-transformer-remark`,
options: {
plugins: [
{
resolve: `gatsby-remark-responsive-iframe`,
options: {
wrapperStyle: `margin-bottom: 1.05rem`,
},
},
`gatsby-remark-prismjs`,
`gatsby-remark-copy-linked-files`,
`gatsby-remark-autolink-headers`,
`gatsby-remark-smartypants`,
],
},
},
`gatsby-plugin-stylus`,
`gatsby-plugin-react-helmet`,
{
resolve: `@gatsby-contrib/gatsby-plugin-elasticlunr-search`,
options: {
// Fields to index
fields: [
'Summary',
'Description',
],
// How to resolve each field's value for a supported node type
resolvers: {
// For any node of type MarkdownRemark, list how to resolve the fields' values
JobsdataXlsmGovtJobs: {
Summary: node => node.Summary,
Description: node => node.Description,
},
},
},
},
] ```
Thanks
from gatsby-plugin-elasticlunr-search.
@ashokballolli Sorry, I haven't seen that error before. Maybe try posting on Stack Overflow or creating a new issue.
from gatsby-plugin-elasticlunr-search.
@dylanpinn How did you determine the resolvers (i.e. wordpress__POST, wordpress__PAGE, wordpress__wp_document)?
I'm trying to implement the plugin using Drupal source data. I keep coming up with the same error @seanngpack was experiencing, "The @gatsby-contrib/gatsby-plugin-elasticlunr-search plugin has generated no Gatsby nodes." I'm thinking my issue is due to not knowing the correct resolvers in my case.
Thanks.
from gatsby-plugin-elasticlunr-search.
Just in case, if you are using prismic, this plugin is looking not for node.type but for node.internal.type which is different (for example "PrismicBlogPage" instead of "BlogPage")
from gatsby-plugin-elasticlunr-search.
For anyone using the gatsby-source-craft
plugin, you can use the GraphQLI explorer to query for the expected Entry type and include the __typename
field in the query to return the correct type for your resolver.
from gatsby-plugin-elasticlunr-search.
Related Issues (20)
- Error: SiteSearchIndex.index field type must be Output Type but got: SiteSearc hIndex_Index. HOT 7
- Getting more info than just title and keywords HOT 1
- GraphQLError: String cannot represent an array value: [] HOT 1
- Installing plugin as a dev dependency on README
- Gatsby v2 Error HOT 2
- Full text search?
- Question: How do I limit the search HOT 2
- Error: duplicate "graphql" modules in Gatsby v2 HOT 3
- How to pass custom options to Elastic Lunr? HOT 1
- Having trouble integrating with Wordpress plugin HOT 3
- error Cannot query field "siteSearchIndex" on type "Query" graphql/template-strings HOT 5
- document in README that re-index needs 'gatsby clean'
- siteSearchIndex not show - resolver problem in config
- Any way to return all results by default? HOT 1
- HOW TO create index of nodes created by hats by source graphql? HOT 1
- Can't seem to work with gatsby-transformer-json HOT 1
- LMDB DUPFIXED size error HOT 1
- Allow to clear the "stop words" in elasticlunr's index HOT 1
- Warnings about multiple equal name modules due to upper and lower case react. HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from gatsby-plugin-elasticlunr-search.