diff --git a/frappe/utils/global_search.py b/frappe/utils/global_search.py index 3ddb2d8a26..03a86e47af 100644 --- a/frappe/utils/global_search.py +++ b/frappe/utils/global_search.py @@ -219,9 +219,15 @@ def insert_values_for_multiple_docs(all_contents): # ignoring duplicate keys for doctype_name frappe.db.multisql( { - "mariadb": """INSERT IGNORE INTO `__global_search` + "mariadb": """INSERT INTO `__global_search` (doctype, name, content, published, title, route) - VALUES {} """.format(", ".join(batch_values)), + VALUES {} + ON DUPLICATE KEY UPDATE + content=VALUE(content), + published=VALUE(published), + title=VALUE(title), + route=VALUE(route) + """.format(", ".join(batch_values)), "postgres": """INSERT INTO `__global_search` (doctype, name, content, published, title, route) VALUES {} @@ -422,6 +428,7 @@ def sync_value_in_queue(value): frappe.cache.lpush("global_search_queue", json.dumps(value)) except redis.exceptions.ConnectionError: # not connected, sync directly + assert not frappe.flags.in_test, "Should not fail silently in tests" sync_value(value)