speed up data access in a search form

后端 未结 2 435
鱼传尺愫
鱼传尺愫 2021-01-23 15:21

In a spring mvc app using hibernate and JPA, I have a keyword class which enables users to search records in an underlying database. The JSP has a search box in a

2条回答
  •  -上瘾入骨i
    2021-01-23 15:24

    I'm afraid the poor client-side performance come from the method your are using for loading the data. I think 80000 records is too much for a DOM source, especially with the search fired on keypress.

    Before the v0.10.0: I recommend you to switch to an AJAX source (with paging enabled). A bit more work is required to set things up but it should have a significant impact on performance. Note that the JSP sample app does use the same technologies (Spring, JPA) as yours. Feel free to take a look.

    However, if you really want to keep loading data with a DOM source, you could simply unbind the keypress event handler, as suggested in this post. To implement it, you'll need the extra JavaScript feature of Dandelion-Datatables.

    Starting from the v0.10.0: the filtering feature has been improved in multiple ways:

    • a time delay (500ms by default, configurable) is always applied before firing the search
    • a min character length can be also configured
    • or you can fire the search on a click event instead

    Of course, using an AJAX source is still recommended but the above features will improve the UX even more. I'll update this anwser with the right links to the new docs and sample apps once this version released.

    Hope this helps!

    (Disclaimer required by StackOverflow: I'm the author of Dandelion)

    EDIT: Dandelion 0.10.0 released. Links added

提交回复
热议问题