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

Initializing with an instance of Level #610

Closed
kldavis4 opened this issue Apr 26, 2023 · 4 comments
Closed

Initializing with an instance of Level #610

kldavis4 opened this issue Apr 26, 2023 · 4 comments

Comments

@kldavis4
Copy link
Contributor

Is it possible to initialize SearchIndex with an already initialized Level db? It seems to expect the Level class and not allow an instance to be passed. If that is the case, how can configuration options be passed to the constructor of the Level class?

In my case, I am using ManyLevelGuest and need to specify the port that it should connect with. I am able to work around the issue by wrapping the instance in an ES6 class, but wondering if there is something more conventional I should be doing.

@kldavis4
Copy link
Contributor Author

I'm wondering if something like adding dbManifest / dbOptions (as per https://github.com/Level/abstract-level/blob/main/types/abstract-level.d.ts#L35) would work. Then when the db is instantiated in the fii they could be passed.

@kldavis4
Copy link
Contributor Author

kldavis4 commented May 2, 2023

Looks like this PR to fii fergiemcdowall/fergies-inverted-index#45 would potentially resolve things.

@fergiemcdowall
Copy link
Owner

Hi @kldavis4 and sorry for the late reply- there is a lot going on here just now!

There is an example in the tests- would something like this work? -> https://github.com/fergiemcdowall/search-index/blob/master/test/src/memory-level-test.js#L40-L43

@fergiemcdowall
Copy link
Owner

search-index@4 now uses abstract-level

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

No branches or pull requests

2 participants