Fast searching on jstree when there is lots of data.

629 views
Skip to first unread message

Abhishek Sharma

unread,
Jul 31, 2015, 7:23:31 AM7/31/15
to jsTree
How can I achieve fast search result with help of search plugin in jstree with loads of data..I tried a solution of a year ago. https://github.com/vakata/jstree/issues/656.
But no luck in that. Please find the attached the log.
premises_data.txt

Ivan Bozhanov

unread,
Jul 31, 2015, 7:35:18 AM7/31/15
to jsTree, mail.abhi...@gmail.com
Please, provide more information. There is absolutely no way to help you with the information you provided (same as your comments in the issue you posted).

1) This question is rhetorical - do not answer, I only include it to let other users who might end up in this thread to not try anything from that issue: What did you TRY exactly? How did you try something that has been in the repo for more than an year? If you tried the code from the beginning of the issue - you shouldn't have done that - it is a closed issue, and has been fixed since April 2014 - there is nothing to try there.

2) Where is your config? There is no way to provide any help based on some raw dump of data - that is only a small part of the information you should have provided.

3) This question would not be necessary if you provided your config: Are you lazy loading nodes? If you have a very large tree - look into that.

4) This question would not be necessary if you provided your config: If you are lazy loading - did you try the AJAX search option - the one that leaves the searching to your backend and loads only what is necessary?

5) This question would not be necessary if you provided your config: Are you using show_only_matches? If so - try disabling it.

6) This question would not be necessary if you provided your config: Are you using a custom search_callback? If so - optimize it, since if you are - all the heavy calculations are in that custom callback function.

7) And finally - which jstree version are you using?

I am afraid no one can help you without you providing enough information.

Best regards,
Ivan

Abhishek Sharma

unread,
Jul 31, 2015, 8:08:23 AM7/31/15
to jsTree, mail.abhi...@gmail.com, ivan.b...@gmail.com
Yeah so firstly i'm calling an api for getting the data (only once) after  that i'm creating the tree. so it's not a lazy loading.
And for the configuration  part, i'm using angularjs so i found a repo for angular jstree on Git https://github.com/ezraroi/ngJsTree
See the attached config.
treeCtrl.js

Ivan Bozhanov

unread,
Jul 31, 2015, 9:11:08 AM7/31/15
to jsTree, mail.abhi...@gmail.com, ivan.b...@gmail.com
Here is demo using your code and the latest jstree: http://jsfiddle.net/DGAF4/700/
I do not believe it is that slow considering the amount of data you are using.

A few tips though:
1) I do not know which jsTree version you are using - keep in mind there was a version which had search.fuzzy set to true, so set it to false in your config just in case.
2) Also consider limiting searches to 3 chars and up. Searching for a single char will be slow, as it will have to expand almost every branch of the tree - the longer the search term, the faster searching will be.

If that is still too slow - consider moving to lazy loading and server side searches, I doubt drawing and searching in 21000 nodes can be much quicker.

Best regards,
Ivan

George Kj

unread,
Aug 11, 2017, 4:01:54 AM8/11/17
to jsTree, mail.abhi...@gmail.com, ivan.b...@gmail.com
Ivan,

Just one doubt. Since there is no feature to configure a delay between two consecutive key stroke, possibilty there to fire search more times even if we limit characters.
Why dont you bring a miminum delay configuration to fire a search ? 
Reply all
Reply to author
Forward
0 new messages