searchbox how to implement database search with huge data

asked 2023-09-21 11:35:43 +0800

wastemails gravatar image wastemails
130 1 2

updated 2023-09-21 11:37:41 +0800

searchbox how to implement database search with huge data (more than 5000 values), client side search is very slow

delete flag offensive retag edit

2 Answers

Sort by ยป oldest newest most voted

answered 2023-11-17 01:52:53 +0800

AndreiArdei gravatar image AndreiArdei
111 3

Hey! So we also had the same issue in our implementation, some searchboxes have over 9k elements and searching was dead slow. I'm of the opinion that going back and forth between the client and the server will only slow it down. Looking at what made the client side so slow was the fact that ZK was trying to delete DOM objects that were not matching the criteria causing the DOM to recalculate. What I did instead was override this and instead just mark elements as invisible with CSS (display none). For us that is a huge improvement. Went down from a key stroke taking ~13 seconds on a 9K dataset to now being ~1 second (of course it now depends on the client, with firefox being noticeably faster)

link publish delete flag offensive edit

answered 2023-10-24 14:57:53 +0800

hawk gravatar image hawk
3205 1 5
http://hawkphoenix.blogsp... ZK Team

updated 2023-10-24 14:58:07 +0800

There are several options:


see https://www.zkoss.org/wiki/ZKComponentReference/Input/Searchbox#Model you can store all data in a SimpleListModel, it will filter data at the server side

add data dynamically

  • assign an empty ListModelList first,
  • listen to onSearching and add the matched data into the ListModelList
link publish delete flag offensive edit


So when we put the model, it will automatically search it ? and automatically limit the data?

BenLimanto ( 2023-11-10 15:55:20 +0800 )edit

if you use SimpleListModel, it filters with startsWith()

hawk ( 2023-11-15 08:59:23 +0800 )edit
Your answer
Please start posting your answer anonymously - your answer will be saved within the current session and published after you log in or create a new account. Please try to give a substantial answer, for discussions, please use comments and please do remember to vote (after you log in)!

[hide preview]

Question tools




Asked: 2023-09-21 11:35:43 +0800

Seen: 10 times

Last updated: Nov 17

Support Options
  • Email Support
  • Training
  • Consulting
  • Outsourcing
Learn More