searchinGhost
searchinGhost copied to clipboard
'SearchinGhost_index' 'setItem' on 'Storage exceeded the quota
I get the follow error in console when using the search: Unable to fetch Ghost data. DOMException: Failed to execute 'setItem' on 'Storage': Setting the value of 'SearchinGhost_index' exceeded the quota. at https://cdn.jsdelivr.net/npm/[email protected]/dist/searchinghost.min.js:2:25425
The search still works currently though, albeit slow. I believe the search worked originally without a console error when I installed it months ago. Maybe it's because there are now 260 posts?
Hi @Luen, sorry for the late reply, did not get any notification.
Yes, that's it. The total amount of space taken by your posts exceed the allowed capacity of browsers local storage. SearchinGhost still do its best to work but cannot rely on the cache mecanism anymore.
Now, you have 2 mains options:
- Stop using a full-text research, only use title and tags (see reference), downside: searches accuracy decrease
- Continue that way, downside: while the index is not fully indexed, search will be laggy
While writing the previous comment, I though about it twice and maybe I should rewrite the cache mechanism.
I tested with my own blog data and currently I store the built index instead of the raw posts data. The goal was to limite JS processing when loading already downloaded data from the cache... but it's 3,46 times heavier !
So maybe, I should store the original posts and rebuild the index on search. Or I should maybe stop using the local storage and switch to IndexedDB or any other technology with higher storage quotas.
I do not have enough time right now to work on that but that might be an interesting feature. I'll leave the issue open as a reminder 😄
Great! Thank you for your in depth reply and possible solutions. searchinGhost is amazing, so thank you for all the work you've done on it.
I think using IndexedDB would be much better idea (we can fallback to localStorage if IndexedDB is not supported) For example in Safari the storage quota is really low. from what I've tested it's just ~2MB, breaking the whole search effectively even with not much data.