[ckan-dev] Custom Search Facets
Rachel Knowler
rachel.knowler at liip.ch
Tue Oct 28 08:19:47 UTC 2014
Sorry, I should have mentioned this in my reply because it's not covered
well in the docs. The new facet that I added is called 'Level'. It's
added to all my datasets as an extra field, during harvesting. In this
line, I add it to the facets_dict:
facets_dict['extras_level'] = p.toolkit._('Level')
It's enough to use the key 'extras_level' to tell CKAN to get the facet
from the extras. The right-hand side is the name of the facet.
Best,
Rachel
On 28.10.2014 09:12, Rachel Knowler wrote:
> Hi Renato,
>
> To add a custom facet search you have to implement the iFacets
> interface in your plugin. This is described in the documentation here:
> http://docs.ckan.org/en/latest/extensions/plugin-interfaces.html#ckan.plugins.interfaces.IFacets.
> I recently did this and you can see my code for it here:
> https://github.com/openresearchdata/ckanext-ord-hierarchy/blob/master/ckanext/ord_hierarchy/plugin.py#L210.
>
> Hope that helps!
>
> - Rachel
>
> On 27.10.2014 16:02, Renato Guevara wrote:
>> I was able to successfully add a custom field to my dataset. In
>> fact, it was a vocabulary with its corresponding tags. However, now,
>> I'm looking into adding a custom facet search for this specific
>> custom field. In this case, the name of my custom field is
>> queryLanguage. I looked through the forum and documentation to see
>> if there were any tutorials but I couldn't find any. Would someone
>> be able to point me in the right direction. Again, I'm trying to add
>> a custom facet search like there is on the default Dataset search
>> page on the left side. Right now, the default ones are "Publishers",
>> "Subjects", "Organizations", "Groups", "Tags", "Formats", and
>> "Licenses". I'd like to add "Query Languages".
>>
>> Thanks,
>>
>> Renato Guevara
>>
>>
>> _______________________________________________
>> 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
>
> --
> Liip AG // Limmatstrasse 183 // CH-8005 Zürich
> Tel +41 43 500 39 80 // Mob +41 78 658 26 12 //www.liip.ch
--
Liip AG // Limmatstrasse 183 // CH-8005 Zürich
Tel +41 43 500 39 80 // Mob +41 78 658 26 12 // www.liip.ch
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.okfn.org/pipermail/ckan-dev/attachments/20141028/3c99f397/attachment-0003.html>
More information about the ckan-dev
mailing list