cosmocode / dokuwiki-plugin-struct

A new structured data plugin
https://www.dokuwiki.org/plugin:struct
GNU General Public License v2.0
40 stars 40 forks source link

Change SQLite ORDER BY by config #616

Closed mschlenstedt closed 10 months ago

mschlenstedt commented 2 years ago

It would be great if one could change the SQLite sorting behaviour by config or (better) option in the aggregation tables. For example I need case insentive sorting in some aggregations. Currently as far as I could seen I only can choose bewteen ASC and DESC, but no more options. Solution for my problem is described here: https://michaelsoolee.com/case-insensitive-sorting-sqlite/

As far as I could seen sorting is done somewhere here:

https://github.com/cosmocode/dokuwiki-plugin-struct/blob/bbfcbfb5a517c054710ae343fdd473359a3e61a9/meta/QueryBuilder.php#L239

Maybe one could add here some more options SQLite offers by default.

splitbrain commented 10 months ago

I would argue that non-casesensitive sorting would always be the better option. So maybe we simply add the NOCASE collation always.

annda commented 10 months ago

Sorting has been case-insensitive for years now (eb55dc17).

@aplitbrain Do we want to introduce any search configuration options, as requested by the original reporter?

splitbrain commented 10 months ago

not needed.

mschlenstedt commented 10 months ago

Well, maybe I am doing something wrong, but the sorting in my wiki is case sensitive - see this screenshot column 1:

AWATTar is sorted before Alexa2Lox. First all upper case, next all lowser case letters.

image

Link to the wiki page: https://wiki.loxberry.de/plugins/start

Code is:

---- struct table ----
schema: pluginuebersicht
cols: %title%, logo, description, version, status, languages, author
sort: %title%
csv: 0
dynfilters: 1
----

DokuWiki is Release 2022-07-31a "Igor", Struct is 2022-08-26. Of course not the latest version, but from 2022...

annda commented 10 months ago

Thanks for the details. In this special case, namely sorting by the "magic" column %title%, the collation is not yet applied.

I need to find the best way to apply it consistently.