[ckan-changes] [okfn/ckan] 52005c: [#730] Only show 'Popular' sort option if tracking...

GitHub noreply at github.com
Wed Apr 3 13:59:42 UTC 2013


  Branch: refs/heads/tracking-fixes
  Home:   https://github.com/okfn/ckan
  Commit: 52005cb098848ffe55117fb46c06be1a96e59c5d
      https://github.com/okfn/ckan/commit/52005cb098848ffe55117fb46c06be1a96e59c5d
  Author: Sean Hammond <seanhammond at lavabit.com>
  Date:   2013-04-03 (Wed, 03 Apr 2013)

  Changed paths:
    M ckan/templates/snippets/sort_by.html

  Log Message:
  -----------
  [#730] Only show 'Popular' sort option if tracking enabled

Sorting datasets by popularity only works if page view tracking is
enabled, so don't show the 'Popular' option in the 'Order by:' dropdown
if tracking isn't enabled.


  Commit: ca04063ce061fb80375e73d5aad865ebd6e0ae6d
      https://github.com/okfn/ckan/commit/ca04063ce061fb80375e73d5aad865ebd6e0ae6d
  Author: Sean Hammond <seanhammond at lavabit.com>
  Date:   2013-04-03 (Wed, 03 Apr 2013)

  Changed paths:
    M ckan/controllers/package.py
    M ckan/lib/search/query.py
    M ckan/logic/action/get.py
    M ckan/templates/snippets/sort_by.html

  Log Message:
  -----------
  [#714] Fix default sort ordering

Change the default sort order of package_search() to 'relevance asc,
metadata_modified desc'. We want to sort by relevance by default, but
when there's no search query relevance is meaningless, in that case fall
back on showing the most recently modified datasets first. Also changes
the sort ordering of the "Relevance" option in the "Order by:" dropdown
to 'relevance asc, metadata_modified desc' instead of just 'relevance
asc'.

The previous default ordering was 'score desc, name asc'. I'm not even
sure if that works, it seems to disagree with the sort strings that the
dropdown gives you, when you chose relevance from the dropdown you got
'relevance asc' not 'score desc' (and the datasets appeared in a
different order then the default), and when you chose name you get
'title_string' not name.

Previously we've fallen back on showing datasets alphabetically but
that's boring as it simply means that all the datasets beginning with 'a'
are always shown. Last modified seems more interesting and changes over
time. Popularity is not an option because that only works if the page
view tracking feature is enabled.

Move the logic that selects the default sort order for package_search()
out of lib and into package_search().

The package_search() action function now returns the sort order it used
in the 'sort' key of the returned dict, and the package controller sends
this to the templates to decide which sort ordering to show selected in
the "Order by:" dropdown. Previously the package controller and action
function each had their own logic and the dropdown was out of sync with
the actual sort order.

Fixes #714.


Compare: https://github.com/okfn/ckan/compare/8db766429d7f...ca04063ce061


More information about the ckan-changes mailing list