Algolia is making changes to firebase database

I need to set setting so alagola don’t write _highlightResult in my database

Hey @diego.pittaluga, what setup are you using for Algolia and Firebase? In normal use cases you should read Firebase changes and push those to Algolia, not the other way around.

Can I get more information (some code) of how you’re synchronising, Thanks!

I am using google cloud functions. I am indexing /job/{jobID}. I noticed Algolia is writing _highlightResult inside the jobs node, what can I do to prevent algolia to write in my DB

Hey, it depends what code is in that task. Can you share it p

ok, I am indexing jobs. This is how I send the job for indexing:

const index = client.initIndex(ALGOLIA_JOBS_INDEX_NAME);
const jobToIndex = {
  description: snap.child("description").val(),
  name: snap.child("name").val(),
  location: snap.child("location").val(),
  budget: snap.child("budget").val(),
  category: snap.child("category").val(),
  type: snap.child("type").val(),
  objectID: id
};
const promises = [];
promises.push(index.saveObject(jobToIndex));

and here is where I am querying:

exports.searchentry = functions.database.ref('/search/{userid}/query/text').onWrite(event => {
  const index = client.initIndex(ALGOLIA_JOBS_INDEX_NAME);
  const query = event.data.val();
  const key = event.data.key;
  const uid = event.params.userid;
  return index.search(query).then(content => {
    const updates = {
      '/search/last_query_timestamp': Date.parse(event.timestamp)
    };
    updates[`/search/${uid}/results/${key}`] = content;
    return admin.database().ref().update(updates);
  });
});

The thing is that algolia is writing the folder ‘_highlightResult’ to the path:

jobs/{jobID}/

I want that part of the DB remain untouched.

Thanks for the response

what setup should I use?

I don’t really understand why you would search Algolia and then put it into Firebase, in any case, if you want to do that, then you can take the content and make a new object with only the parts that you need. In combination with attributesToRetrieve and attributesToHighlight in the parameters of search:

index.search({
  query,
  attributesToRetrieve: [
    /*whatever you need*/
  ],
  attributesToHighlight: [
    /*nothing*/
  ],
});

Thanks your code works.

I put it in firebase so I can retrieve the results. What are other options?