Do not index a document if it's empty

The prepare_node_data function returns an empty dict if the node
is not of the INDEX_ALLOWED_NODE_TYPES, or if it's not published, etc.
This commit is contained in:
Francesco Siddi 2018-03-21 02:17:58 +01:00
parent 67a24e9d4e
commit d30a11c8f7

View File

@ -177,6 +177,10 @@ def node_save(node_id: str):
to_index = prepare_node_data(node_id)
if not to_index:
log.debug('Node %s will not be indexed', node_id)
return
for searchoption in current_app.config['SEARCH_BACKENDS']:
searchmodule = SEARCH_BACKENDS[searchoption]
searchmodule.index_node_save(to_index)