in reply to Re: data bulk query, sorting and paging
in thread data bulk query, sorting and paging

Datasets may be in the thousands, or millon rows...

The problem I have with delegating sorting and querying to providers is that paging gets really tricky.

my @rows; for my $provider( qw/Provider1 Provider2 Provider3/ ) { push @rows, $provider->search( query=>..., sort=>..., page=>1, rows=>10 ); } # now I may end up with 30 rows for page 1 # but the client grid expects 10, so let's cut it down... @rows = @rows [ 0..9 ];

So, ideally, the "collection manager object" should work with this algorithm:

  1. Ask each provider to search for a certain query and sort
  2. Ask for a row from each provider starting at a given page
  3. Is the page complete? Then call any external filters callbacks.
  4. External filters dropped rows? Then keep fetching until page is complete again.
  5. Sort the combined rows
  6. Return resulting array, but keep track of the current paging state

--Miguel

Code tags added by GrandFather

Replies are listed 'Best First'.
Re^3: data bulk query, sorting and paging
by AnomalousMonk (Archbishop) on Nov 30, 2009 at 18:32 UTC
    Please do not use  <pre> tags: they usually screw up browser rendering. Please Update your reply and, in particular, your original post to use  <c> ... </c> tags around code (and output) instead. Please see Markup in the Monastery et al.