Skip to content

Plugins are not restored from the saved database #934

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

Open
Alnipet opened this issue May 14, 2025 · 0 comments
Open

Plugins are not restored from the saved database #934

Alnipet opened this issue May 14, 2025 · 0 comments

Comments

@Alnipet
Copy link

Alnipet commented May 14, 2025

Describe the bug

I’m using the @orama/plugin-embeddings plugin, and everything works fine until I try to save the database to disk and then restore it after a server restart. We don’t store plugin data in the file, so when restored, the database is created without plugins.

packages/orama/src/methods/serialization.ts

export function load<T extends AnyOrama>(orama: T, raw: RawData): void {
  orama.internalDocumentIDStore.load(orama, raw.internalDocumentIDStore)
  orama.data.index = orama.index.load(orama.internalDocumentIDStore, raw.index)
  orama.data.docs = orama.documentsStore.load(orama.internalDocumentIDStore, raw.docs)
  orama.data.sorting = orama.sorter.load(orama.internalDocumentIDStore, raw.sorting)
  orama.tokenizer.language = raw.language
}

export function save<T extends AnyOrama>(orama: T): RawData {
  return {
    internalDocumentIDStore: orama.internalDocumentIDStore.save(orama.internalDocumentIDStore),
    index: orama.index.save(orama.data.index),
    docs: orama.documentsStore.save(orama.data.docs),
    sorting: orama.sorter.save(orama.data.sorting),
    language: orama.tokenizer.language
  }
}

and in packages/plugin-data-persistence/src/index.ts

And when searching, I get this error:

"Cannot read properties of undefined (reading 'property')" в @orama\\orama\\src\\methods\\search-vector.ts:23:62

To Reproduce

  1. I start the application and create a database with the plugin-embeddings plugin.
  2. I add embeddings.
  3. I restart the server and persist the database to a file.
  4. The database is restored.
  5. When trying to perform a vector search, I get error: "Cannot read properties of undefined (reading 'property')" в @orama\orama\src\methods\search-vector.ts:23:62

Expected behavior

I expect the search to complete without errors

Environment Info

Orama: 3.1.6

Affected areas

Initialization

Additional context

No response

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

1 participant