Ticket #1453 (closed enhancement: fixed)

Opened 2 years ago

Last modified 2 years ago

Flexible tag names

Reported by: icmurray Owned by: icmurray
Priority: major Milestone: ckan-sprint-2011-12-05
Component: ckan Keywords: tags tag
Cc: dread Repository: ckan
Theme: none

Description (last modified by icmurray) (diff)

Allowing more flexible tag names:

  • allowing spaces
  • allow capital letters (search is case in-sensitive)
  • allow all punctuation except for commas and double-quotes '"'
  • allow unicode
  • commas delimit tag names in the package create/edit form

Effects:

  • package creation/edit form.
  • /tag/{tagname} uri
  • search action
  • api controller (search/package-create/edit)
  • web controller (search/package-create/edit)
  • search api documentation
  • autocomplete for tag names

Change History

comment:1 Changed 2 years ago by icmurray

  • Description modified (diff)

comment:2 Changed 2 years ago by icmurray

  • Description modified (diff)

comment:3 Changed 2 years ago by icmurray

Added the restriction of not allowing the double quote character, '"', as well as commas as this simplifies any use of quoting multiple words to mean a single tag name.

For example, this simplifies the use of quotes in identifying tags in internal markdown links:

tag:"multiple word tag name"

A possible solution is to allowing escaping, such as:

tag:"something about \"Ian\""

But I think the compromise is a better solution than allowing the escaping as it's simpler, and this may crop up elsewhere.

comment:4 Changed 2 years ago by icmurray

  • Status changed from new to accepted

The allowable characters in a tagname has changed to "unicode alphanmeric plus simple punctuation". This means:

  • alphanumeric (inc. foreign characters)
  • [ .-_]

The completed feature is in the feature-1453-flexible-tag-names branch.

Awaiting a code review.

comment:5 Changed 2 years ago by icmurray

  • Description modified (diff)

comment:6 Changed 2 years ago by dread

Code review:

  • basically - really excellent code and very thorough :-)
  • links should have %20 rather than spaces (tests/misc/test_format_text.py:61)
  • also check unicode chars encoding in urls (tests/misc/test_format_text.py:115)
  • also check searching for the tag with this encoding (ckan/tests/functional/api/model/test_tag.py:35)
  • we follow the PEP8 coding style which I interpret to mean not having blank lines after a function definition. But whichever, we're not consistent from file to file, but we should be within each file. e.g. ckan/tests/forms/test_package.py:12.
  • moo package problem - need to ensure test works on its own and when run as part of the suite, so independent of whether moo exists. tests/functional/api/test_action.py:
  • best to make tag search case insensitive - see ckan/tests/functional/api/model
  • It's worth keeping the old test in addition to your modified one - because query for just {q:} will return both packages too. ckan/tests/functional/api/test_package_search.py:203
  • Let's add an example of tag search with quotes in /doc/api.rst:337
  • Please put imports at the top of the file, unless there's a good reason ckan/tests/functional/api/test_package_search.py:296
  • Can you not the old test any more? It seems sufficiently to the test you changed it to, so can we include both? ckan/tests/functional/api/test_package_search.py:295

comment:7 Changed 2 years ago by icmurray

  • Milestone changed from current-ckan-sprint-2011-11-21 to ckan-sprint-2011-12-05

comment:8 Changed 2 years ago by icmurray

Updated code now in feature-1453-flexible-tag-names branch.

(Also, deleted the ian-review branch.)

comment:9 Changed 2 years ago by dread

  • Status changed from accepted to closed
  • Resolution set to fixed

I believe this is finished now. This was merged into master in cset:c0aaa31c4b7ded54d and headed for release 1.5.2.

comment:10 Changed 2 years ago by dread

This has gone into release 1.6.

Note: See TracTickets for help on using tickets.