Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix: JavaScript Fix error when searching after load() and view() #484

Merged
merged 2 commits into from
Oct 11, 2024

Conversation

abetomo
Copy link
Contributor

@abetomo abetomo commented Sep 8, 2024

I got an error when I loaded and searched with load() or view().

Code Example:

// Saved with `index.save('index.usearch');` in another script.
index.load('index.usearch');
const results = index.search(new Float32Array([0.2, 0.6, 0.4]), 10);

Error:

/build/javascript/dist/cjs/usearch.js:314
        const result = __classPrivateFieldGet(this, _Index_compiledIndex, "f").search(normalizedVectors, k);
                                                                               ^

TypeError: Search failed
    at Index.search (/build/javascript/dist/cjs/usearch.js:314:80)
    at Object.<anonymous> (/build/example.js:9:21)
    at Module._compile (node:internal/modules/cjs/loader:1469:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1548:10)
    at Module.load (node:internal/modules/cjs/loader:1288:32)
    at Module._load (node:internal/modules/cjs/loader:1104:12)
    at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:174:12)
    at node:internal/main/run_main_module:28:49

Node.js v20.17.0

This bug fixed.

I got an error when I loaded and searched with load() or view().

Code Example:
```js
// Saved with `index.save('index.usearch');` in another script.
index.load('index.usearch');
const results = index.search(new Float32Array([0.2, 0.6, 0.4]), 10);
```

Error:
```
/build/javascript/dist/cjs/usearch.js:314
        const result = __classPrivateFieldGet(this, _Index_compiledIndex, "f").search(normalizedVectors, k);
                                                                               ^

TypeError: Search failed
    at Index.search (/build/javascript/dist/cjs/usearch.js:314:80)
    at Object.<anonymous> (/build/example.js:9:21)
    at Module._compile (node:internal/modules/cjs/loader:1469:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1548:10)
    at Module.load (node:internal/modules/cjs/loader:1288:32)
    at Module._load (node:internal/modules/cjs/loader:1104:12)
    at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:174:12)
    at node:internal/main/run_main_module:28:49

Node.js v20.17.0
```

This bug fixed.
@DavidGOrtega
Copy link

@abetomo great!! Im suffering the same.
Can someone please check this?

@ashvardanian ashvardanian changed the base branch from main-dev to main September 14, 2024 17:48
@ashvardanian ashvardanian changed the base branch from main to main-dev September 14, 2024 17:49
@ashvardanian
Copy link
Contributor

There is a compilation issue on Clang, that needs to be resolved to merge this, @DavidGOrtega & @abetomo. Will do my best to merge tomorrow. Thanks for contributions, guys!

javascript/lib.cpp Outdated Show resolved Hide resolved
@ashvardanian ashvardanian merged commit 16dec63 into unum-cloud:main-dev Oct 11, 2024
6 of 8 checks passed
@ashvardanian
Copy link
Contributor

@abetomo, thank you for being so active, responsive, and ready to operate across languages! It’s great to have you on our side 🤗

@abetomo abetomo deleted the fix-load-and-view branch October 11, 2024 01:31
@abetomo
Copy link
Contributor Author

abetomo commented Oct 11, 2024

Thanks for your review!
I would like to continue to contribute.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants