From df8afb8b14fd460eb02a8f17f51b5eef2beb3dc5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sybren=20A=2E=20St=C3=BCvel?= Date: Wed, 14 Sep 2016 09:38:33 +0200 Subject: [PATCH] Append license notes to Algolia index So we can keep nodes without description or uploaded by other users (like textures), with clean names and still be able to search them easily by their copyright notes. Reviewers: sybren, fsiddi Reviewed By: sybren, fsiddi Differential Revision: https://developer.blender.org/D2225 --- pillar/api/utils/algolia.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/pillar/api/utils/algolia.py b/pillar/api/utils/algolia.py index 60eb1a6f..8305c963 100644 --- a/pillar/api/utils/algolia.py +++ b/pillar/api/utils/algolia.py @@ -81,12 +81,15 @@ def algolia_index_node_save(node): if 'permissions' in node and 'world' in node['permissions']: if 'GET' in node['permissions']['world']: node_ob['is_free'] = True + # Append the media key if the node is of node_type 'asset' if node['node_type'] == 'asset': node_ob['media'] = node['properties']['content_type'] - # Add tags - if 'tags' in node['properties']: - node_ob['tags'] = node['properties']['tags'] + + # Add extra properties + for prop in ('tags', 'license_notes'): + if prop in node['properties']: + node_ob[prop] = node['properties'][prop] current_app.algolia_index_nodes.save_object(node_ob)