Return-Path: Delivered-To: apmail-couchdb-user-archive@www.apache.org Received: (qmail 17777 invoked from network); 13 Sep 2010 04:20:20 -0000 Received: from unknown (HELO mail.apache.org) (140.211.11.3) by 140.211.11.9 with SMTP; 13 Sep 2010 04:20:20 -0000 Received: (qmail 57692 invoked by uid 500); 13 Sep 2010 04:20:18 -0000 Delivered-To: apmail-couchdb-user-archive@couchdb.apache.org Received: (qmail 56922 invoked by uid 500); 13 Sep 2010 04:20:15 -0000 Mailing-List: contact user-help@couchdb.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: user@couchdb.apache.org Delivered-To: mailing list user@couchdb.apache.org Received: (qmail 56906 invoked by uid 99); 13 Sep 2010 04:20:15 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 13 Sep 2010 04:20:14 +0000 X-ASF-Spam-Status: No, hits=2.2 required=10.0 tests=FREEMAIL_FROM,HTML_MESSAGE,RCVD_IN_DNSWL_NONE,SPF_PASS,T_TO_NO_BRKTS_FREEMAIL X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of mikeal.rogers@gmail.com designates 209.85.216.180 as permitted sender) Received: from [209.85.216.180] (HELO mail-qy0-f180.google.com) (209.85.216.180) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 13 Sep 2010 04:20:10 +0000 Received: by qyk31 with SMTP id 31so5291971qyk.11 for ; Sun, 12 Sep 2010 21:19:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:received:in-reply-to :references:date:message-id:subject:from:to:cc:content-type; bh=hLHf0G8VVRjcc/sNPUddad4mzA0BmSjK9VWqRkGioJQ=; b=VpyWSj0mTSAl6OxjAXohahpw1ntSGwHJFwL2gYZa2D9Uv3vM0rcXvAwpwnSqyjAQBl S+qD6Q1dBSyZ6uTH2OzoN2BuR936wfIzht2cZSCoN5yEC4qctGh4MmD1EspIFkMpA1PY gsnVrjIYF8qzkkkcAanULXaeSbCi4tGw+z5ok= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; b=LcOOlvqlbx1ukGsjS9gyn8pkDcxgIwbo9evIujJh/6a0vIJ7viNs+lYqAtuRHvifnV CreNX8WLDWKQY/vXTiE4q3Nd0S7+1wPU423zkbqJQsUdtU/5V+JZNemVM4oD5xNB6xOI ipZR7xp/3hSxq5/JqbcHFWUM4YOMvvSmWOTP4= MIME-Version: 1.0 Received: by 10.224.113.215 with SMTP id b23mr299220qaq.267.1284351586232; Sun, 12 Sep 2010 21:19:46 -0700 (PDT) Received: by 10.229.249.81 with HTTP; Sun, 12 Sep 2010 21:19:46 -0700 (PDT) In-Reply-To: References: <15DB6D61-5832-47B8-A2CA-8C608BCA1965@apache.org> Date: Sun, 12 Sep 2010 21:19:46 -0700 Message-ID: Subject: Re: endkey doesn't obey limit parameter and always returns entries starting with offset 0 From: Mikeal Rogers To: user@couchdb.apache.org Cc: "dev@couchdb.apache.org" Content-Type: multipart/alternative; boundary=000feaf2082f106da404901c6800 --000feaf2082f106da404901c6800 Content-Type: text/plain; charset=ISO-8859-1 Without a transaction it's impossible to insure fully consistent results between pages. startkey + docid is the best we can offer, maybe we should add a simplified API to jquery.couch.js and document best practices. -Mikeal On Sun, Sep 12, 2010 at 9:04 PM, Damien Katz wrote: > It's possible to do it that way, it just needs a way to navigate down the > correct btree nodes and it's pretty cheap. But it ceases to be cheap with > partitioned setups, like in BigCouch. > > Also since the index can change between reads, using offset may produce > values out of order, duplicate or skipped values in your UI. Startkey + > docid generally produces better semantics. > > -Damien > > > On Sep 12, 2010, at 8:21 PM, Randall Leeds wrote: > > > Any reason why we don't put a document count in the btree index to make > skip > > cheap? > >> > >> On Sep 12, 2010, at 9:39 AM, Mikeal Rogers wrote: > >> > >>> For pagination you can use the skip parameter instead of trying to > change > >>> the startkey for each pagination. > >>> > >>> http://wiki.apache.org/couchdb/HTTP_view_API#Querying_Options > >>> > >>> ?startkey="foo"&limit=10 > >>> ?startkey="foo"&limit=10&skip=10 > >>> ?startkey="foo"&limit=10&skip=20 > >>> > >> > >> You can but you shouldn't. > >> > >> The right way to do it is to use startkey and limit, as documented here. > >> > >> http://guide.couchdb.org/draft/recipes.html#fast > >> > >>> > >>> On Sun, Sep 12, 2010 at 12:06 AM, Henrik Skupin > > wrote: > >>> > >>>> Hi, > >>>> > >>>> For my current Couch application I'm using pagination to show only 50 > >>>> results per page. To navigate back and forward the endkey vs. startkey > >>>> parameters are used. While startkey in combination with limit is > working > >>>> fine, endkey doesn't return results for [offset(endkey)-limit, > >>>> offset(endkey)] but for [0, limit]. This makes pagination impossible > for > > me > >>>> and looks like to be a bug. An example you can find here: > >>>> > >>>> http://mozmill.hskupin.info/general/reports > >>>> > >>>> After opening the page click 'Next' twice and check the URL of the > >>>> 'Previous' link before clicking on it. The endkey parameter will not > be > >>>> obeyed and a click on that link causes the first page to be opened. > >>>> > >>>> The code can be found at: http://github.com/whimboo/mozmill-dashboard > >>>> > >>>> Is the above problem a known broken behavior and worth filing a bug? > >>>> > >>>> Thanks, > >>>> Henrik > >>>> > >> > > --000feaf2082f106da404901c6800--