Skip to content

Commit

Permalink
Use action=upsert for back-filling data.
Browse files Browse the repository at this point in the history
  • Loading branch information
jasonbosco committed Jan 23, 2024
1 parent 2bddd3d commit 28edfdb
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 3 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## Version 1.3.0-rc.1

- Use `action=upsert` for back-filling data

## Version 1.2.0

- Upgrade to Node 18
Expand Down
2 changes: 1 addition & 1 deletion extension.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: firestore-typesense-search
version: 1.2.0
version: 1.3.0-rc.1
specVersion: v1beta # Firebase Extensions specification version (do not edit)

displayName: Search Firestore with Typesense
Expand Down
4 changes: 2 additions & 2 deletions functions/src/backfillToTypesenseFromFirestore.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ module.exports = functions.firestore.document(config.typesenseBackfillTriggerDoc
await typesense
.collections(encodeURIComponent(config.typesenseCollectionName))
.documents()
.import(currentDocumentsBatch);
.import(currentDocumentsBatch, {action: "upsert"});
currentDocumentsBatch = [];
functions.logger.info(`Imported ${currentDocumentNumber} documents into Typesense`);
} catch (error) {
Expand All @@ -68,7 +68,7 @@ module.exports = functions.firestore.document(config.typesenseBackfillTriggerDoc
await typesense
.collections(encodeURIComponent(config.typesenseCollectionName))
.documents()
.import(currentDocumentsBatch);
.import(currentDocumentsBatch, {action: "upsert"});
functions.logger.info(`Imported ${currentDocumentNumber} documents into Typesense`);
} catch (error) {
functions.logger.error("Import error", error);
Expand Down

0 comments on commit 28edfdb

Please sign in to comment.