[ckan-discuss] Search dataset/package by tag from vocab
stephane at opennorth.ca
Tue Sep 24 16:58:18 BST 2013
Yeah! found the solution (after few hours of search). I also document it
here for anybody interested;
So by default, CKAN defines the attribute vocab_*myVocabularyName*.
In order to do a search on a tag in the vocabulary territoire, the url
would be .../dataset?vocab_territoire=un
But, in order to work, the vocabulary has to be indexed in SOLR... Add a
config line in schema.xml, something like:
<field name="vocab_territoire" type="string" indexed="true" stored="true"
By playing with the iController thing it would be possible to change the
value (from vocab_territoire to just territoire) but in our case we won't
On Sun, Sep 22, 2013 at 8:57 PM, Stéphane Guidoin <stephane at opennorth.ca>wrote:
> 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
> 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?*
> 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!
Twitter: @opennorth / @hoedic
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the ckan-discuss