typesense / typesense/typesense-js
`emplace` is not available for single index updates necessitating the use of `import`
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 569
- Forks
- 99
- Avg merge
- 5h 6m
- Merged PRs (30d)
- 2
Description
I noticed different behavior between documents().import(, { action: "emplace" }) and documents().upsert(, { action: "emplace"}), with the latter working with the behavior of an upsert instead of update when a partial document is passed.
In src/Typesense/Documents.ts:220, the DocumentWriteParameters action property is overwritten by the Object.assign call, negating the ability to pass an action to the upsert call.
Are all actions valid for the upsert call? Perhaps the line could be changed to
Object.assign({}, options, { action: options.action ?? "upsert" })
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in src/Typesense/Documents.ts around line 220 and compare how import and upsert pass DocumentWriteParameters.action. Confirm which actions the upsert call accepts, then verify that an explicitly supplied action is preserved while the default remains upsert; run the relevant project tests to confirm the behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- api
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100