docsify icon indicating copy to clipboard operation
docsify copied to clipboard

feat: introduce a text compress for search function

Open Koooooo-7 opened this issue 1 year ago • 1 comments

Summary

The search INDEX we store in localStorage, and it has the limitation about 5M. And we discussed about the Indexed DB and other solutions couple years ago. Today, a sudden inspiration struck me: instead of switching the persistence layer, we can use text compression to address our retrieval needs. So I have found some implementations of text compression algorithms,and pick the suitable one of LZW lz-string since we are more on the content/docs. Have a test based on our site docs, it reduces the 80% cost. In short term, it could be a chance for users to make search still works when their docs big but not that too much.

As-is

Screenshot 2024-06-13 at 20 23 53

Enable compress

Screenshot 2024-06-13 at 20 25 46

Related issue, if any:

What kind of change does this PR introduce?

Feature

For any code change,

  • [x] Related documentation has been updated, if needed
  • [ ] Related tests have been added or updated, if needed

Does this PR introduce a breaking change?

Yes No

No

Tested in the following browsers:

  • [x] Chrome
  • [ ] Firefox
  • [ ] Safari
  • [ ] Edge

Koooooo-7 avatar Jun 13 '24 12:06 Koooooo-7

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
docsify-preview ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jun 13, 2024 0:31am

vercel[bot] avatar Jun 13 '24 12:06 vercel[bot]

closed via #2464 .

Koooooo-7 avatar Aug 02 '24 13:08 Koooooo-7