[Xapian-tickets] [Xapian] #697: Omega SORTREVERSE semantics confusing

Xapian nobody at xapian.org
Thu Dec 10 00:24:50 GMT 2015


#697: Omega SORTREVERSE semantics confusing
--------------------+-----------------------------
 Reporter:  olly    |             Owner:  olly
     Type:  defect  |            Status:  assigned
 Priority:  normal  |         Milestone:  1.3.4
Component:  Omega   |           Version:  1.3.3
 Severity:  normal  |        Resolution:
 Keywords:          |        Blocked By:
 Blocking:          |  Operating System:  All
--------------------+-----------------------------

Comment (by olly):

 We went over "ascending"/"descending" vs "reversed" several times in the
 discussion in #311, and ended up with "reverse" as what we use in the C++
 API.  Partly that was because we'd already muddied the waters over what
 "ascending" and "descending" meant, and probably enough time has now
 passed that people won't be confused by that historical meaning, but
 aligning omega and xapian-core's terminology seems helpful (particular for
 people hacking on Xapian, but also for users who interact with both omega
 and core).

 Putting this into `SORT` seems a plausible option.  Using `-` doesn't seem
 ideal (as it makes the argument look like a signed number, and then `-0`
 being different to `0` is a bit surprising), but we could use a different
 character.

 I wonder which is easier to use in HTML forms.  If you're building the UI
 with JS it makes little difference - I'm thinking about a plain HTML UI.
 I guess it depends if you want a selector for what to sort by with a
 checkbox for "reverse", or a selector which includes forward and reverse
 versions of each sort key.  Both are probably plausible UIs, though it's
 perhaps unhelpful to change which Omega can do in plain HTML.

 Perhaps this actually points to decoupling the CGI parameters from what
 they control, so you should be able to say something like:

 {{{
 $setsort{$cgi{SORT},$cgi{SORTREV}}
 }}}

 or if you want the leading `-` approach:

 {{{
 $if{$eq{$substr{$cgi{SORT},0,1},-},$setsort{$substr{$cgi{SORT}},1},true},$setsort{$cgi{SORT},}}
 }}}

 Or to just hardcode a reversed sort on value 0:

 {{{
 $setsort{0,1}
 }}}

 But that's probably out of scope for crowbarring in before 1.4.x - we'd
 want to do this consistently for all the CGI parameters.

--
Ticket URL: <http://trac.xapian.org/ticket/697#comment:4>
Xapian <http://xapian.org/>
Xapian



More information about the Xapian-tickets mailing list