N
Size: a a a
N
D
AO
// Update the search index every time a blog post is written.
export const onBikeAdded = functions.firestore.document('bikes/{bikeId}').onCreate((snap, context) => {
// Get the note document
const bike = snap.data();
// Add an 'objectID' field which Algolia requires
bike!.objectID = context.params.bikeId;
// Write to the algolia index
const index = client.initIndex(ALGOLIA_INDEX_NAME);
// @ts-ignore
return index.addObject(bike);
});
Р
Р
N
// Update the search index every time a blog post is written.
export const onBikeAdded = functions.firestore.document('bikes/{bikeId}').onCreate((snap, context) => {
// Get the note document
const bike = snap.data();
// Add an 'objectID' field which Algolia requires
bike!.objectID = context.params.bikeId;
// Write to the algolia index
const index = client.initIndex(ALGOLIA_INDEX_NAME);
// @ts-ignore
return index.addObject(bike);
});
PE
DE
Р
DE
PE
Ж
Р
Р
PE
Р
D
PE
AO