Skip to content

Commit

Permalink
[#1158] Index resource.mimetype_inner instead of
Browse files Browse the repository at this point in the history
resource.format (if available).

Has to be in CKAN core for now as resources are
removed from pkg_dict before it is passed to
plugin.before_index.
  • Loading branch information
johnglover committed Aug 5, 2013
1 parent cf64899 commit 4a9280c
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion ckan/lib/search/index.py
Expand Up @@ -163,9 +163,16 @@ def index_package(self, pkg_dict, defer_commit=False):
# flatten the structure for indexing:
for resource in pkg_dict.get('resources', []):
for (okey, nkey) in [('description', 'res_description'),
('format', 'res_format'),
# ('format', 'res_format'),
('url', 'res_url')]:
pkg_dict[nkey] = pkg_dict.get(nkey, []) + [resource.get(okey, u'')]

# EU ODP:
# use resource mimetype_inner for res_format if available
format = [resource.get('mimetype_inner', u'') or
resource.get('format', u'')]
pkg_dict['res_format'] = pkg_dict.get('res_format', []) + format

pkg_dict.pop('resources', None)

rel_dict = collections.defaultdict(list)
Expand Down

0 comments on commit 4a9280c

Please sign in to comment.