[ckan-dev] MIN_TAG_LENGTH

Harald von Waldow harald.vonwaldow at eawag.ch
Mon Nov 2 20:14:24 UTC 2015


Hi Stefan and Ian,

thanks a lot for the quick feedback!

I guess I forgot to mention that this is indeed about vocabulary tags. I
suppose this prevents me from using IDatasetForm and also from using an
extra field, as I want to use the controlled vocabulary mechanism.

So I though Stefan's suggestion to modify display_name would be the
proper solution, also because validating others' assumptions about tag
names is obviously bad.

I am creating the vocabularies with a remote script using API calls to
vocabulary_create and tag_create.
Directly passing display_name to tag_create doesn't work because in that
call path the absence of display_name is asserted and then it is
automatically created from name.

The other idea was to use vocabulary_update after initial creation. In
that call path the default validator for tags strips out display_name,
but that could be overridden by passing a modified schema in the context
of update_vocabulary. Except that ckanapi.RemoteCKAN will not let me
pass context ....

So this is getting a bit too involved with respect to my current
priorities. I am giving up on that now, unless someone comes up with
that simple solution I overlooked. And reading a bit of code was
certainly not in vain.

All the best,
Harald


On 10/30/2015 02:45 PM, Ian Ward wrote:
> Hello Harald,
> 
> You can customize the validation on tags on your CKAN site to allow
> different characters and minimum lengths with an IDatasetForm plugin.
> Stefan mentions that this would make it harder to harvest your
> datasets to other CKAN instances. If that's a concern for you you
> could also store your tags in an extra field with a custom schema
> instead of ussing the core tags field. So, you do have a couple
> options.
> 
> I'd definitely avoid monkey patching, since CKAN's plugins already let
> you do what you're looking for.
> 
> Ian
> 
> On Fri, Oct 30, 2015 at 9:29 AM, Stefan Oderbolz
> <stefan.oderbolz at liip.ch> wrote:
>> Hi Harald,
>>
>>> What is the reason that not MIN_TAG_LENGTH = 1?
>>
>>
>> I don't know why this exists, my guess is that it has to do with the Solr
>> search, as all the tags are indexed and could create wrong search results.
>> Why not use something like chemical-formula-c?
>> Please consider the use case that someone else wants to harvest your data,
>> they might have to change this MIN_TAG_LENGTH. And depending on the context
>> "c" could mean different things.
>>
>>
>>>
>>> What is the proper way to override this constant?
>>
>>
>> You could monkey-patch it, but I would advice against it.
>>
>>>
>>> Related: Why can't tags contain non-aphanumeric characters other than
>>> [_-.]? ( "Si(OH)4" would be nice.)
>>
>>
>> This is mainly because the tag is used as a URL slug. Nowadays there is not
>> strictly a limitation to alphanummeric characters in URLs, but it's still
>> better not to use them I guess. But you could use a tag vocabulary and
>> change the display_name of the tag.
>>
>> - Stefan
>>
>> --
>> Liip AG  // Limmatstrasse 183 //  CH-8005 Zürich
>> Tel +41 43 500 39 80 // GnuPG 0x7B588C67 // www.liip.ch
>>
>> _______________________________________________
>> ckan-dev mailing list
>> ckan-dev at lists.okfn.org
>> https://lists.okfn.org/mailman/listinfo/ckan-dev
>> Unsubscribe: https://lists.okfn.org/mailman/options/ckan-dev
>>
> _______________________________________________
> ckan-dev mailing list
> ckan-dev at lists.okfn.org
> https://lists.okfn.org/mailman/listinfo/ckan-dev
> Unsubscribe: https://lists.okfn.org/mailman/options/ckan-dev
> 

-- 
Harald von Waldow
Eawag
ICT Services
Ueberlandstrasse 133
8600 Duebendorf
http://www.eawag.ch



More information about the ckan-dev mailing list