You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Tokenizer's tokenize() method returns a promise (it's an async function), but it's not treated as a promise. There's several calls without awaiting the result.
It resulted in errors like:
file:///Users/xred/dev/orama-test/node_modules/.pnpm/@[email protected]/node_modules/@orama/orama/dist/esm/components/index.js:130
for (const token of tokens) {
^
TypeError: tokens is not iterable
at <anonymous> (/Users/xred/dev/orama-test/node_modules/.pnpm/@[email protected]/node_modules/@orama/orama/src/components/index.ts:239:29)
at Object.insert (/Users/xred/dev/orama-test/node_modules/.pnpm/@[email protected]/node_modules/@orama/orama/src/components/index.ts:279:12)
at indexAndSortDocumentSync (/Users/xred/dev/orama-test/node_modules/.pnpm/@[email protected]/node_modules/@orama/orama/src/methods/insert.ts:243:17)
at innerInsertSync (/Users/xred/dev/orama-test/node_modules/.pnpm/@[email protected]/node_modules/@orama/orama/src/methods/insert.ts:130:3)
at insert (/Users/xred/dev/orama-test/node_modules/.pnpm/@[email protected]/node_modules/@orama/orama/src/methods/insert.ts:37:10)
at <anonymous> (/Users/xred/dev/orama-test/src/index.ts:13:7)
Node.js v22.13.1
ELIFECYCLE Command failed with exit code 1.
If you patch the package and log the tokens variable:
Describe the bug
I was trying to upgrade from Orama v2 to v3, and the tokenizers module was a few problems that blocks me from upgrading.
package.json
points to invalid paths:./build/tokenizer-mandarin/tokenizer.mjs
doesn't exist, only./build/tokenizer-mandarin/tokenizer.js
exists./build/tokenizer-mandarin/tokenizer.d.ts
doesn't exist, only./build/tokenizer-mandarin/tokenizer.ts
existsTokenizer's
tokenize()
method returns a promise (it's an async function), but it's not treated as a promise. There's several calls without awaiting the result.It resulted in errors like:
If you patch the package and log the
tokens
variable:It's indeed a promise, but there's no
await
in the code.To Reproduce
https://github.com/fuma-nama/orama-test
pnpm dev
Expected behavior
No error should be thrown in my example above.
Environment Info
Affected areas
Search
Additional context
No response
The text was updated successfully, but these errors were encountered: