You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Evan Sho <in...@evansho.net> on 2002/05/13 18:31:16 UTC
Pagination support
Just skim thur the suggestions. However, I have a
question very fundamental to that in the pipeline
process. If the pagination is done in transformer, it
means the generator will have all result generated and
the transformer just cut out the unwanted one. It
could means many rows in the result will be unused.
Also, even the generator is cached, many un-usually
used rows will be in the cache.
My idea is, get what you need and cache what you
usually use. for example, in the sitemap:
<map:match pattern="longlist">
<map:action type="pagination">
<map:parameter name="item-per-page" value="20">
<map:generate type="sql" src="select * from emp
limit {starting-row}, {item-per-page}"/>
....
if i have oracle database, i will write:
<map:generate type="sql" src="select * from
(select * from (select * from (select * from emp order
by empno) e where rowid < {item-per-page-x-pageid}) f
order by empno desc) g where rowid <
{item-per-page}"/>
(although it is a bit complicated, but if i
usually get only 0.1% of my result in the first 3
pages, it should be worthy)
of course the pagination action will caculate and pass
all necessary value to the generator. the generator
cache key is generated by the hash of the sql
statement, so i am sure only those most frequently
used records are in my cache.
and the pagination support in transformer also give me
another problem, say if i have news item nested in
month node:
<month id="0cg234">
<news id="02384" title="XX"/>
<news id="20343" title="YY"/>
...
</month>
<month id="ouhou90">
...
</month>
would it be hard if i have the page break in the
middle of a month? however, if i do the paginate
calculation before generate, i know exactly how many
row will be in the result.
I don't know if I have any mis-understanding in the
pagination in scratchpad (no doc at all X-p), but I am
quite sure that filtertransformer is good only when
all pages are frequently used.
Just my 2 cents, please please kindly comment on my
idea.
Regards
Evan
--- Christian Haul
<ha...@dvs1.informatik.tu-darmstadt.de> wrote:
> > BTW, how should I do pagination in cocoon? I mean
> if I
> > have 100+ rows and want to display them page by
> page
> > with 10 rows per page, is there any general
> practice
> > to do that?
>
> a) esql supports skip rows and max rows
> b) there's a paginating transformer in scratchpad
> c) FilterTransformer does paginating
>
> Chris.
>
__________________________________________________
Do You Yahoo!?
LAUNCH - Your Yahoo! Music Experience
http://launch.yahoo.com
---------------------------------------------------------------------
Please check that your question has not already been answered in the
FAQ before posting. <http://xml.apache.org/cocoon/faqs.html>
To unsubscribe, e-mail: <co...@xml.apache.org>
For additional commands, e-mail: <co...@xml.apache.org>
Re: Pagination support
Posted by Christian Haul <ha...@dvs1.informatik.tu-darmstadt.de>.
On 13.May.2002 -- 09:31 AM, Evan Sho wrote:
> Just skim thur the suggestions. However, I have a
> question very fundamental to that in the pipeline
> process. If the pagination is done in transformer, it
> means the generator will have all result generated and
> the transformer just cut out the unwanted one. It
> could means many rows in the result will be unused.
> Also, even the generator is cached, many un-usually
> used rows will be in the cache.
Yep.
> My idea is, get what you need and cache what you
> usually use. for example, in the sitemap:
> <map:match pattern="longlist">
> <map:action type="pagination">
> <map:parameter name="item-per-page" value="20">
>
> <map:generate type="sql" src="select * from emp
> limit {starting-row}, {item-per-page}"/>
> ....
> if i have oracle database, i will write:
> <map:generate type="sql" src="select * from
> (select * from (select * from (select * from emp order
> by empno) e where rowid < {item-per-page-x-pageid}) f
> order by empno desc) g where rowid <
> {item-per-page}"/>
>
> (although it is a bit complicated, but if i
> usually get only 0.1% of my result in the first 3
> pages, it should be worthy)
OK, granted. In my opinion, this caching should be done in the jdbc
layer or at least a seperate component, though. I thought there has
been announced some framework for that but I couldn't find it again.
Anyway, have a look at
http://www.geocities.com/sundar_rajan_in/java/servlets/databasecaching.html
it looks like J2EE or jdk1.4 does have some provisions for that.
> would it be hard if i have the page break in the
> middle of a month? however, if i do the paginate
> calculation before generate, i know exactly how many
> row will be in the result.
To be honest, I have never used the pagination transformer and after
having a short look at it, it seems, well, underdocumented.
> I don't know if I have any mis-understanding in the
> pagination in scratchpad (no doc at all X-p), but I am
> quite sure that filtertransformer is good only when
> all pages are frequently used.
Cached items time out. I don't know enough about the cache system to
say whether all cached items from one invocation of the
FilterTransformer time out together or if more frequent items survive
longer. Carsten?
Chris.
--
C h r i s t i a n H a u l
haul@informatik.tu-darmstadt.de
fingerprint: 99B0 1D9D 7919 644A 4837 7D73 FEF9 6856 335A 9E08
---------------------------------------------------------------------
Please check that your question has not already been answered in the
FAQ before posting. <http://xml.apache.org/cocoon/faqs.html>
To unsubscribe, e-mail: <co...@xml.apache.org>
For additional commands, e-mail: <co...@xml.apache.org>