[ckan-changes] [okfn/ckan] 8685c6: [release-1.6.1][solr] Expose sorting of solr resul...

GitHub noreply at github.com
Thu Mar 15 18:29:35 UTC 2012


  Branch: refs/heads/release-v1.6.1
  Home:   https://github.com/okfn/ckan
  Commit: 8685c6000d1cb211928b4dbc63990fb72d884f8c
      https://github.com/okfn/ckan/commit/8685c6000d1cb211928b4dbc63990fb72d884f8c
  Author: Ian Murray <ian.murray at okfn.org>
  Date:   2012-03-15 (Thu, 15 Mar 2012)

  Changed paths:
    M ckan/controllers/package.py

  Log Message:
  -----------
  [release-1.6.1][solr] Expose sorting of solr results in the package controller.

Although the search module already supported sorting of results by a number
of fields, it wasn't exposed in the url parameters of the package controller's
search action.

 - action now accepts a "sort" url parameter, which can be used to specify
   the fields to sort on (using the standard solr syntax). eg:
   "&sort=metadata_modified%20desc,%20url%20desc"

 - provided a helper function for generating the correct urls from templates.

Note - solr only accepts sorting upon fields that are not multi-valued; are
   indexed; and uses a singleTerm analyzer (or none at all).  This means
   we're not currently able to sort by fields with type "text" (as
   defined in our solr schema.xml). eg - the "title" field.


  Commit: 226ac1456b0533cd3fd9d22fcece2b354dde9a77
      https://github.com/okfn/ckan/commit/226ac1456b0533cd3fd9d22fcece2b354dde9a77
  Author: Ian Murray <ian.murray at okfn.org>
  Date:   2012-03-15 (Thu, 15 Mar 2012)

  Changed paths:
    M ckan/config/solr/schema-1.3.xml

  Log Message:
  -----------
  [release-1.6.1][solr] Added a new field, titleString, to the solr schema.

Since the 'title' field is of type 'text', it means we can't sort on it.  So I've added a new
solr field that has a copy of the 'title' field, but of type 'string', meaning it can be
sorted on.

There are other 'text' fields, but I think the 'title' is likely the only one we'd want to
sort on.

This change is backwards compatible, hence not creating a new version of the schema


Compare: https://github.com/okfn/ckan/compare/9491210...226ac14


More information about the ckan-changes mailing list