fergiemcdowall / search-index

A persistent, network resilient, full text search library for the browser and Node.js
MIT License
1.38k stars 149 forks source link

How to disconnect search-index db? #534

Closed everlose closed 3 years ago

everlose commented 3 years ago

I'm connected to DB,I need to change my db connection after a while,but how to disconnect origin connection?

const searchDB = await si({name: 'xxx'})

searchDB.disconnect() // ???

await si({name: 'yyy'})
fergiemcdowall commented 3 years ago

This isnt really something that we have considered necessary- what is your use case? Why do you need to disconnect?

Maybe you could close the underlying store? In search-index si.INDEX.STORE points to the underlying level store so you would run si.INDEX.STORE.close()

everlose commented 3 years ago

em...Yes, It doesn't need to be closed manually, forget it.