|
follow up to: sorted ftsearch results in XPages (with code!)
This is a follow up to my previous post about sorted ftsearch results, and it is inspired by ideas Tommy Valand wrote about.
The problem with my previous approach was, that I could not cache the result. So while using a pager, or on re-sorting, all the expensive work (doing the ftsearch, getting all NotesViewEntries) was done over and over again. I could not cache the result, since the TreeMap contained Notes objects which are recyled after the page is delivered to the browser. Now I created a "fake" NotesViewEntry object which only stored Java objects. So after doing the ftsearch, I create one fake NotesViewEntry for each real NotesViewEntry, and store that in the TreeMap. Then I get the sorted list of values (as Array) out of the TreeMap and store that into the viewScope. On pagination I simply return that cached Array, and on re-sort I use that Array to re-sort the values. The ftsearch and looping over the NotesViewEntries is done only exactly once during the lifetime of the page. I didn't implement the descending sort order yet, but that shouldn't be hard since the TreeMap.values() collection can be reversed by one single method call. So, here is my current code as RTF download (sorry for that, but when I tried to put the code in this blog post, I reached the size limit of blog posts...): ynNotesView code. The code contains lots of comments and should be easy to understand. I'm happy about any comments how to improve that code further.
Comments (7) | Permanent Link | Search the Lotus universe at searchlotus.com!
Links: YouAtNotes Software | Worklow-Engine for Lotus Notes and Web | All-in-one web-based support solution | XPages knowledge collection wiki German links: YouAtNotes Startseite | CRM Software für Lotus Notes | Prozessmanagement / Workflow Software | OpenSource Web-CMS |
|


