josdejong / josdejong/jsoneditor

Tree search very slow. Additional options for tree searchbox needed.

Open
#366 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
12.3k
Forks
2.1k
PR merge metrics
No merged PRs in 30d

Description

Hi,

I use the JSONEditor to display a very big JSON file (1MB=30000 lines, is this really big?). The tree and all other modes are working perfect and fast. But when I use the search box in the tree mode and enter 1 character, e.g. "u", the complete browser is completly hanging because of searching for this "u". I have a lot of nodes with keyname "uuid". I think this could be the problem here? Or has the tree search a known performance problem?

It would be nice if I can set some options for the search field when creating the JSONEditor instance. For example, that the realtime search should only start if the user enters at least 3 characters.
Or a possibility to disable the realtime search and only search if user press the"Enter" key.

I found in the source dist/jsoneditor.js (v5.5.11) in line 11379 the following code:

```
SearchBox.prototype._onSearch = function (forceSearch) {
this._clearDelay();

var value = this.dom.search.value;
var text = (value.length > 0) ? value : undefined;

````

If this "0" would be parameterized, then I could set it to "2" and the search starts only when user enters at least 3 characters. But this solves not the tree search performance, or?!

Regards,
Mario

**UPDATE:**
It could be that not the search is the problem, but the expanding of each node where the "u" is found. Because the "u" is found 2000 times. Actually not so much, but it seems the browser is hanging during drawing the big tree with all nodes open where the "u" was found.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.