-
-
Notifications
You must be signed in to change notification settings - Fork 291
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
searchWithHighlight crashes after persistence restore #446
Comments
Hi, thank you for opening this issue! |
I am seeing this too, not with Orama persistence but I have my own code for retrieving it from json.
|
I believe the issue might be in the Looks like it's missing from here: orama/packages/orama/src/methods/serialization.ts Lines 20 to 28 in fc6e863
|
Perhaps something like this within export type RawDataWithPositions = RawData & {
positions: Record<string, Record<string, Record<string, Position[]>>>
}
export async function saveWithHighlight(
orama: OramaWithHighlight,
): Promise<RawDataWithPositions> {
const data = await save(orama)
return {
...data,
positions: orama.data.positions,
}
} Edit: I figured that would fix the issue but I am still getting the error even when positions is present |
I think I have it working, but there seems to be an issue in the export async function loadWithHighlight(
orama: OramaWithHighlight,
raw: RawDataWithPositions,
): Promise<void> {
await loadOramaDB(orama, raw)
orama.data.positions = raw.positions
} |
Describe the bug
When db is restored using data persistence plugin the search with higlight functionality no longer works
To Reproduce
Steps to reproduce the behavior:
Expected behavior
not crash with error
Screenshots
Desktop (please complete the following information):
The text was updated successfully, but these errors were encountered: