Giter VIP home page Giter VIP logo

Comments (6)

KyleAMathews avatar KyleAMathews commented on September 23, 2024 1

graphql-js has the utilities to parse & modify the query — https://graphql.org/graphql-js/language

You can see it in action here: https://astexplorer.net/#/gist/6741b9816f2a912253551d349096621d/5c732d8915bdc59ed75ecb6fd1838ea713a1478c

Happy to pair with you sometime on the implementation! I'd love to help y'all speed this up sooner than later as it's a slower part of many people's builds.

from gatsby-plugin-algolia.

Haroenv avatar Haroenv commented on September 23, 2024

As the user writes the query themselves, would you be thinking of somehow changing the query to add the contentDigest, or to recommend using that as the matchFields by default in the readme/code?

Thanks for the suggestion @KyleAMathews!

from gatsby-plugin-algolia.

KyleAMathews avatar KyleAMathews commented on September 23, 2024

Yeah, you should rewrite the query to make sure it's always returning the contentDigest. And then cache the node's id/contentDigest so that you can compare it with the next build. Then you can automatically only send data for nodes that are either a) new or b) changed. This would make indexing really fast most of the time as most builds only have ~1-10 nodes that have changed. I'm just now looking at a site on Gatsby Cloud that takes ~100s on every build to index to Algolia 😱

from gatsby-plugin-algolia.

Haroenv avatar Haroenv commented on September 23, 2024

Is there some way in Gatsby to transform the query? Trying to parse the query would be much too much work. If you have any idea how it could be implemented, the plugin is fairly simple, so I can review a PR you make @KyleAMathews :)

from gatsby-plugin-algolia.

KyleAMathews avatar KyleAMathews commented on September 23, 2024

Here's a little gist showing the basics of rewriting a query https://gist.github.com/KyleAMathews/a7342ebad8f8f0ea6938f61649358248

from gatsby-plugin-algolia.

KyleAMathews avatar KyleAMathews commented on September 23, 2024

Closed by #162 — thanks @Haroenv !

from gatsby-plugin-algolia.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.