Merge pull request #34692 from ankush/global_search_update
fix: Update values on conflict in global search
This commit is contained in:
commit
5bbdff9018
1 changed files with 9 additions and 2 deletions
|
|
@ -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)
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue