瀏覽代碼

Merge pull request #4087 from pratu16x7/hotfix

[hotfix] global search: ignore results with non-existent doctypes
version-14
Rushabh Mehta 7 年之前
committed by GitHub
父節點
當前提交
64b81cffc9
共有 4 個文件被更改,包括 11 次插入3 次删除
  1. +1
    -0
      frappe/patches.txt
  2. +0
    -0
      frappe/patches/v8_10/__init__.py
  3. +5
    -0
      frappe/patches/v8_10/delete_static_web_page_from_global_search.py
  4. +5
    -3
      frappe/utils/global_search.py

+ 1
- 0
frappe/patches.txt 查看文件

@@ -192,3 +192,4 @@ frappe.patches.v8_5.delete_email_group_member_with_invalid_emails
frappe.patches.v8_x.update_user_permission
frappe.patches.v8_5.patch_event_colors
frappe.patches.v8_7.update_email_queue_status
frappe.patches.v8_10.delete_static_web_page_from_global_search

+ 0
- 0
frappe/patches/v8_10/__init__.py 查看文件


+ 5
- 0
frappe/patches/v8_10/delete_static_web_page_from_global_search.py 查看文件

@@ -0,0 +1,5 @@
from __future__ import unicode_literals
import frappe

def execute():
frappe.db.sql("""delete from `__global_search` where doctype='Static Web Page'""");

+ 5
- 3
frappe/utils/global_search.py 查看文件

@@ -307,9 +307,11 @@ def search(text, start=0, limit=20, doctype=""):
limit {start}, {limit}'''.format(start=start, limit=limit), (doctype, text), as_dict=True)

for r in results:
if frappe.get_meta(r.doctype).image_field:
doc = frappe.get_doc(r.doctype, r.name)
r.image = doc.get(doc.meta.image_field)
try:
if frappe.get_meta(r.doctype).image_field:
r.image = frappe.db.get_value(r.doctype, r.name, frappe.get_meta(r.doctype).image_field)
except Exception:
frappe.clear_messages()

return results



Loading…
取消
儲存