[ckan-discuss] Search dataset/package by tag from vocab

Stéphane Guidoin stephane at opennorth.ca
Mon Sep 23 01:57:29 BST 2013


Hi there,

I am working on a CKAN implementation where we will add some vocabulary
tags for local districts. This is very similar to the iDataSetForm example
country codes released with CKAN.

However, one thing is not covered in the example and I'm not able to figure
how to make it work: enable search (and facetting) based on this vocabulary.

So my vocabulary is "territoire" and within this vocabulary I have some
tags with values "un", "deux" and "trois".

To do a search by tag, I can do:

   - In the web interface : http://myckan.net/dataset?*tags=myTag*
   - Via the API: http://myckan.net/api/3/action/package_search?*
   q=tags:myTag*

But when I try it on my vocabulary, I get empty answers:

   - In the web interface : http:///myckan.nedataset?*tags=un*
   - Via the API: http://myckan.net/api/3/action/package_search?*q=tags:un*


But when I call package_show, I see my tag "un" in my dataset (with the
correct vocabulary_id).
So must I provide an added parameter to my search? I tried something like
...package_search?q=tags:un&vocabulary_id= either the vocab name and vocab
id but I get an error. Should I do something in the plugin to enable the
search on the vocabulary?

Thank you in advance!

Steph
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.okfn.org/pipermail/ckan-discuss/attachments/20130922/8c7a975a/attachment.htm>


More information about the ckan-discuss mailing list