Giter Site home page Giter Site logo

Comments (5)

Bruce773 avatar Bruce773 commented on June 15, 2024 1

My implementation was actually pretty simple... I just created a script that would build the replica indices then construct the primaries all based on the queries I was originally passing into gatsby-plugin-algolia:

const algoliasearch = require('algoliasearch');
const { algoliaQueries, algoliaReplicaIndices } = require('./algoliaQueries');

module.exports.syncAlgoliaSettings = async function() {
    const client = algoliasearch(id, key);

    for (const item of algoliaReplicaIndices) {
      const { indexName, settings } = item;
      client
        .initIndex(indexName)
        .setSettings(settings, {}, (_err, content) =>
          console.log('Algolia replica index: ', content),
        );
    }

    for (const item of algoliaQueries) {
      const { indexName, settings, query, transformer } = item;
      client
        .initIndex(indexName)
        .setSettings(settings, { forwardToReplicas: true, transformer, query }, (_err, content) =>
          console.log(_err, content),
        );
    }
};

from gatsby-plugin-algolia.

Bruce773 avatar Bruce773 commented on June 15, 2024 1

I kept getting an error saying A replica index is already replica of another index... I believe I tracked it down to the fact that replica indices were being added to _tmp indices... Once I filtered that out, it seemed to work. But, I'm still testing some things out.

from gatsby-plugin-algolia.

Haroenv avatar Haroenv commented on June 15, 2024 1

Thanks for looking into this @Bruce773

from gatsby-plugin-algolia.

Haroenv avatar Haroenv commented on June 15, 2024

I'd like to see what changes you've made to the plugin, to be honest, it wasn't made with replicas in mind initially, maybe just a few waitTask on the right spot should do the job just fine?

from gatsby-plugin-algolia.

Bruce773 avatar Bruce773 commented on June 15, 2024

@Haroenv I spent some time digging into the plugin code and I think I've got a solution. :)
yogainternational@fc7a124

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.