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
<[EMAIL PROTECTED]> 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: <[EMAIL PROTECTED]>
For additional commands, e-mail: <[EMAIL PROTECTED]>

Reply via email to