-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Andrew,

Andrew Martin wrote:
> I am interested to know the ‘best’ practice for navigating through
> long lists.

I haven't used Struts-layout, so I'm not sure how my suggestion will
fit-in with your preferred display engine, but here goes, anyway.

We have a search application that uses Lucene as an index and a database
to store the actual data. Searches are performed using Lucene and then
the real data is fetched for display. Needless to say, many results may
be returned, so paging is necessary.

Lucene basically returns an list of record ids to us, which we store in
an array of ints, which is relatively small (even if /all/ records match
the query, we'll only get 15k of ids back). We wrap that list in a
"paged record" which contains a cache.

This paged record object has a "getRecord" method that first checks to
see if the record has already been loaded in the cache, and returns it
if it was there. If it's a cache miss, then the cache is emptied and we
load an entire "page" of records from the database to fill the cache.

This allows the pager to believe that it's iterating through a complete
list of data, while the underlying object is actually caching and
discarding data so that only the essentials are kept in memory (that is,
the complete list of record ids and the current page of full records).

We keep that object in the user's session so that page reloads don't
have to go back to the database and are nice and fast.

I hope that helps,
- -chris
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFFnQf19CaO5/Lv0PARAjO1AKC6iBQgG0LNlbfGpCbotNgxt2MCdwCgu7eJ
oSdgiNJCQu9PCWo5zB/vIHw=
=ewkK
-----END PGP SIGNATURE-----

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to