Hello All! I have built a search engine for searching scientific documents. However, I am facing problem in pagination. My simple question is that all my results for a query are stored in 3d array: Document Score Path. I want to display the results in multiple pages.
Many a topics discussed in this forum concern displaying results obtained from database. But my situation is different. I have retrieved all the results in a 3-d array. I just want to display them. Kindly help me on this.
Why do you fetch all the results? That's not going to scale well. Is it not possible for you to only fetch a page's worth of data at a time? That'd be most efficient as well as well as easier to deal with.
What would be best then (assuming you cannot pre-page the data) is to transform the data to a simple list (assuming that's what you will display) in the page controller rather than in the JSP itself. It's best to keep the JSPs as "dumb" as possible and do all the heavy lifting in Java code in the controllers.
What I don't understand is all the time you are going to spend dealing with breaking up the large dataset when you are just going to have to throw it all away later when you change how the data gets fetched. It's clearly not something that's trivial, why not just do it the right way from the beginning?