https://bugzilla.wikimedia.org/show_bug.cgi?id=45090

--- Comment #4 from christ...@quelltextlich.at ---
(In reply to comment #3)
> My current understanding is that these are equivalent:
> 
> * ?q=limit:[integer] and &n=[integer]

Yes, they are more or less equivalent. However, &n=[integer] provides
you with a "_more_changes" field, while ?q=limit:[integer] does not.

You can however circumvent this difference, by keeping the limiting
integer below your queryLimit while still asking for 1 more result
than needed.

In some edge cases, gerrit will even give you one more result than
your queryLimit allows for.

> * ?q=sortkey_after:[sortkey] and &N=[sortkey]
> * ?q=sortkey_before:[sortkey] and &P=[sortkey]

It's actually the other way round.
  ?q=sortkey_after corresponds to &P=
  ?q=sortkey_before corresponds to &N=

* sortkey is increasing for new changes.
* &N= is for the /N/ext page of search results (i.e.: older changes,
  lower sortkeys, hence sortkey_before)
* &P= is for the /P/revious page of search results (i.e.: newer
  changes, higher sortkeys, hence sortkey_after)

As confusing as this is already, there are further
differences. ?q=sortkey_after skips the first search result. So when
comparing
https://gerrit.wikimedia.org/r/changes/?P=00232fbd0000bc17&n=3
https://gerrit.wikimedia.org/r/changes/?q=sortkey_after:00232fbd0000bc17&n=3
you'll get something like
     sortkey        In q=sortkey... ?  In P=... ?
     ...               ...              ...
002330130000c1d5       no               no
0023300f0000c1d8       no               no
00232fff0000bc7b       yes              no
00232ff10000c1d6       yes              yes
00232fec0000c1d3       yes              yes
00232fd50000bf53       no               yes
00232fbd0000bc17 <---- used sortkey

Additionally, if you supply a &n=[integer] parameter to limit the
number of results, the result set for a ?P= query has the
"_more_changes" key set on the first object, while a &sortkey_after=
query has it set on the last object.

(This result skipping, and shuffling around "_more_changes" does not
occur for ?q=sortkey_before or ?N= queries)

Bottom line: When trying to process the data automatically, I'd go for
using &n=[integer] to obtain "_more_changes" marker, but I would not
rely on getting at most [integer] results. Be prepared that there may
be one additional result in the result set. Furthermore, I'd go for the
&N=, and &P= variants, keeping in mind that the "_more_changes" need
not be at the end.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
You are the assignee for the bug.
You are watching all bug changes.
_______________________________________________
Wikibugs-l mailing list
Wikibugs-l@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/wikibugs-l

Reply via email to