[ckan-dev] Tag Frequency List for Tag Cloud
Stéphane Guidoin
stephane at opennorth.ca
Wed May 7 14:37:30 UTC 2014
Hey Rodrigo,
Yes, there is a way to get the tag count with get_facet_items_dict applied
to tags, see below
{% set tags = h.get_facet_items_dict('tags', limit=20) %}
In each tag item, you will have count attribute that gives you the number
of time the tag is used.
Steph
On Wed, May 7, 2014 at 10:27 AM, Rodrigo Parra <rodpar07 at gmail.com> wrote:
> Hello all,
>
> I'm trying to implement a tag cloud similar to the one that can be found
> at: http://opendatahub.it/
> I've looked around and could not find the server side source code for this
> feature.
>
> Anyway, I need a JSON tag frequency list from the server, like this one:
>
> cloud =
> [{"text":"popolazione","size":"621"},{"text":"ambiente","size":"553"},{"text":"territorio","size":"362"},{"text":"cartografia","size":"328"},{"text":"energia","size":"317"},{"text":"2012-2013","size":"306"},{"text":"statistica","size":"301"},{"text":"2006-2011","size":"248"},{"text":"turismo","size":"233"},{"text":"commercio","size":"229"},{"text":"formazione","size":"60"}];
>
> I was thinking about exposing this functionality by implementing the
> *IActions* interface.
> I can use the *package_search *action to get all datasets with their
> tags, and compute the frequency list myself.
>
> However, I think this approach might not scale well, as it could become
> quite resource consuming with a big number of datasets. Therefore, my
> question is:
>
> Does anyone has any suggestions regarding a better approach to get the
> frequency list? Is there any API action I'm missing?
>
> Thanks in advance,
> Rodrigo
>
> _______________________________________________
> 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
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.okfn.org/pipermail/ckan-dev/attachments/20140507/935f0c03/attachment-0003.html>
More information about the ckan-dev
mailing list