question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Serialize big indexes (get rid of TokenStore?)

See original GitHub issue

Hello there,

I’m building a browser based application (without a webserver). I’ll have multiple documents to index (in my case, about 700) and the cumulated weight of those documents is about 5 MB.

For now, my application rebuilds the index every time the webpage is displayed, but it takes about 40 seconds to build the full index, which is very long.

I want to store the index in the browser but I can’t even serialize it. Here is what I get when I try to JSON.stringify() my index:

Uncaught RangeError: Maximum call stack size exceeded

After a short investigation, the problem seems to come from JSON.stringify() which can’t handle big object. In fact, after a heap snapshot, it occurs that my TokenStore is about ~ 70 MB…!

screen shot 2014-04-30 at 15 30 53

I will not even try to store such a big object in a browser, but maybe I’m looking in the wrong way here. Maybe there is a way to store the index without the TokenStore and rebuild it somehow?

Thank you!

Issue Analytics

  • State:closed
  • Created 9 years ago
  • Comments:11 (6 by maintainers)

github_iconTop GitHub Comments

3reactions
olivernncommented, Jul 3, 2017

Three years later there is a major new version of Lunr, 2.x, which has a much simpler serialised structure. Upgrading to this latest version should hopefully alleviate any issues with trying to serialise the large, deeply nested, data structure that Lunr 0.x and 1.x have.

2reactions
kigcommented, May 26, 2016

You can play with a live demo at https://tabletree.io - I ended up rolling a simplified search optimized for speed and index wire size. The index is 1MB gzipped and the searches take <20ms, so you get nice live updates as you type.

Client-side archiving might get you 10-20% wire size boost compared to gzip, but you end up spending more time decompressing the data, so I figured I’d just make the source data more gzip-friendly. Building the search index on the client-side is a non-starter as the corpus is a hundred megs in size – need to build a compressed index off-line and transfer just that to the client.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to Create a Custom Token Store for Spring-Security-Oauth2
Curious to learn how to create your own spring security token store? For most it can take a few hours of focused work....
Read more >
Spring Security OAuth2: Purge TokenStore - Stack Overflow
Here's an idea how I would add such a mechanism. Expiration date is part of OAuth2AccessToken which gets persisted as a serialized java...
Read more >
Use Case 2: Reading/Deserializing and Writing/Serializing ...
In addition to storing schema metadata, another key use case is to store metadata for the format of how data should be read...
Read more >
SnapshotStateList - Android Developers
An implementation of MutableList that can be observed and snapshot. ... add(index: Int, element: T) ... Check out Android Developers on YouTube.
Read more >
Hive Configuration Properties - Apache Software Foundation
Note: See Indexing for more configuration properties related to Hive ... It means the data of small table is too large to be...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found