From mboxrd@z Thu Jan 1 00:00:00 1970 From: Jelle Licht Subject: Re: GSoC: Adding a web interface similar to the Hydra web interface Date: Wed, 4 Jul 2018 23:47:14 +0200 Message-ID: References: <87d0xyn9zs.fsf@elephly.net> <87d0xswvls.fsf@elephly.net> <87r2m4ntk4.fsf@mdc-berlin.de> <87tvqxy4i9.fsf@elephly.net> <87in78hxo2.fsf@elephly.net> <878t7xb58o.fsf@elephly.net> <874lijbqvf.fsf@elephly.net> <20180606200210.7a9c4dd6@scratchpost.org> <20180612183504.2621cefa@scratchpost.org> <8736xrd64y.fsf@elephly.net> <8736x8ype9.fsf@gnu.org> Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="000000000000b4727b0570335ff7" Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:45938) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fapcR-000353-7n for guix-devel@gnu.org; Wed, 04 Jul 2018 17:47:24 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fapcO-0008DH-53 for guix-devel@gnu.org; Wed, 04 Jul 2018 17:47:23 -0400 Received: from mail1.fsfe.org ([217.69.89.151]:46334) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1fapcN-00087d-Pt for guix-devel@gnu.org; Wed, 04 Jul 2018 17:47:20 -0400 Received: by mail-oi0-f45.google.com with SMTP id m2-v6so13029255oim.12 for ; Wed, 04 Jul 2018 14:47:16 -0700 (PDT) In-Reply-To: List-Id: "Development of GNU Guix and the GNU System distribution." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-devel-bounces+gcggd-guix-devel=m.gmane.org@gnu.org Sender: "Guix-devel" To: Tatiana Sholokhova Cc: guix-devel --000000000000b4727b0570335ff7 Content-Type: text/plain; charset="UTF-8" 2018-07-04 22:54 GMT+02:00 Tatiana Sholokhova : > Hi all, > > Hi Tatiana, > I just committed the code I wrote trying to improve pagination. I screwed > up a bit with the new pagination. > The problem I encountered is following. If we want to maintain a link to > the previous page we have to filter the database table entries with to > types of filters: one with lower bound on the id, and the other with the > upper bound. As we do so simultaneously with limiting the query output to > the maximal page size, we need to change the ordering type depending on the > type of the filter. At the moment I am not sure, what it the best way to > implement database query with such properties. Could you please take a look > on the commit and share your ideas on that? > > The current implementation of pagination works correctly but it does not > support link to the previous page (first, and next only). > It has been some time since I last had a look at databases, so you have my apologies in advance if what I am saying does not really apply, or is even not entirely correct. You could perhaps have a look at reversing the sort order, and replace ">" with "<" and "<" with "<" in your WHERE clauses. The query to the previous page would be similar to retrieving the next page, but basically reversing the order you would page through the results, if that makes any sense. If this works, you could also hack together a maybe-efficient query to retrieve the items for the last page; simply insert the maximum possible value in your query, and retrieve the previous page with regards to that maximum value. In the current case, you could enter the highest possible value any id can have. If it is possible for new items to show up on previous pages as well (so with id's that are lower than the highest id), you would need to replace your sorting and filtering to act on a composite value of e.g. , instead of on only the id value. > > I have been trying to improve pagination for a while, and I now am > thinking about starting the parallel work on the implementation of the > features we listed before. What do you think about it? > > Best regards, > Tatiana > > Good luck, and HTH! - Jelle --000000000000b4727b0570335ff7 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable


2018-07-04 22:54 GMT+02:00 Tatiana Sholokhova &l= t;tanja201396@gm= ail.com>:
=
Hi all,


Hi = Tatiana,
=C2=A0
I just committed the code I wrote trying to improve pagina= tion. I screwed up a bit with the new pagination.=C2=A0
The probl= em I encountered is following. If we want to maintain a link to the previou= s page we have to filter the database table entries with to types of filter= s: one with lower bound on the id, and the other with the upper bound. As w= e do so simultaneously with limiting the query output to the maximal page s= ize, we need to change the ordering type depending on the type of the filte= r. At the moment I am not sure, what it the best way to implement database = query with such properties. Could you please take a look on the commit and = share your ideas on that?

The current implementation of pa= gination works correctly but it does not support link to the previous page = (first, and next only).

It has been s= ome time since I last had a look at databases, so you have my apologies
=
in advance if what I am saying does not really apply, or is even= not entirely correct.

You could perhaps have a look at r= eversing the sort order, and replace ">" with "<"= and "<"
with "<" in your WHERE clauses. The = query to the previous page would be similar to
retrieving the next page= , but basically reversing the order you would page through the results, if that makes any sense.

If this works, you could also hack togethe= r a maybe-efficient query to retrieve the items
for the last = page; simply insert the maximum possible value in your query, and retrieve = the
previous page with regards to that maximum value. In the = current case, you could enter the
highest possible value any = id can have.

If it is possible for new items t= o show up on previous pages as well (so with id's that are lower
th= an the highest id), you would need to replace your sorting and filtering to= act on a composite
value of e.g. <id, timestamp>, inst= ead of on only the id value.
=C2=A0

I have bee= n trying to improve pagination for a while, and I now am thinking about sta= rting the parallel work on the implementation of the features we listed bef= ore. What do you think about it?

Best regards,
<= div>Tatiana

Good luck, and HTH!

- Jelle
--000000000000b4727b0570335ff7--