Skip to content

Commit

Permalink
Facet adjustments.
Browse files Browse the repository at this point in the history
- Only update eurovoc_category_label facet if not already present in
  facet dict.
- Add further information about facet search to readme.
  • Loading branch information
brew committed Apr 28, 2015
1 parent 886fe3b commit d3ca50b
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 6 deletions.
14 changes: 11 additions & 3 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,6 @@ do::
Configuration
-------------

Adding templates, and Eurovoc category field to the dataset schema
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

The Eurovoc plugin doesn't automatically change CKAN templates or add a Eurovoc
category field to your dataset schema.

Expand Down Expand Up @@ -124,6 +121,17 @@ Note: Changing the value of ``category_field_name`` will not migrate previous
values assigned to the old field name.


Search facet
++++++++++++

The Eurovoc plugin will add a faceted search option to dataset, group and
organization search page.

You can make adjustments to the Eurovoc facet in your own extension by
updating the ``eurovoc_category_label`` entry in the facet dictionary using
the appropriate ``IFacets`` interface methods.


-----------------
Running the Tests
-----------------
Expand Down
8 changes: 5 additions & 3 deletions ckanext/eurovoc/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,9 +94,11 @@ def organization_facets(self, facets_dict, organization_type, package_type):
return facets_dict

def _update_facets(self, facets_dict):
facets_dict.update({
'eurovoc_category_label': plugins.toolkit._('Eurovoc Categories')
})
'''Add `eurovoc_category_label` to facets if not already present.'''
if 'eurovoc_category_label' not in facets_dict:
facets_dict.update({
'eurovoc_category_label': plugins.toolkit._('Eurovoc Categories')
})

# IPackageController

Expand Down

0 comments on commit d3ca50b

Please sign in to comment.