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:
@@ -177,6 +177,10 @@ def node_save(node_id: str):
|
|||||||
|
|
||||||
to_index = prepare_node_data(node_id)
|
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']:
|
for searchoption in current_app.config['SEARCH_BACKENDS']:
|
||||||
searchmodule = SEARCH_BACKENDS[searchoption]
|
searchmodule = SEARCH_BACKENDS[searchoption]
|
||||||
searchmodule.index_node_save(to_index)
|
searchmodule.index_node_save(to_index)
|
||||||
|
Reference in New Issue
Block a user