fergiemcdowall / search-index

A persistent, network resilient, full text search library for the browser and Node.js

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Initializing with an instance of Level

kldavis4 opened this issue · comments

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.

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.

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

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

search-index@4 now uses abstract-level