Use when implementing search functionality in Frappe v14-v16. Covers link field search (search_link), global search, FullTextSearch (Whoosh), SQLiteSearch FTS5 [v15+], Awesomebar customization, search_fields configuration, custom search queries, and website search. Prevents common mistakes with missing search_fields and permission filtering. Keywords: search, search_link, global_search, FullTextSearch, Awesomebar,, search not finding, link field empty, autocomplete not working, global search missing results. search_fields, standard_queries, SQLiteSearch, FTS5, Whoosh.
Instalar com Codex ou Claude Copie este prompt, cole no Codex, Claude ou outro assistente e deixe que ele revise a página da skill e instale para você.
Um comando direto ignora o prompt de revisão. Verifique a origem antes de executá-lo.
Instruções da origem · Visualização somente leitura
name
frappe-core-search
description
Use when implementing search functionality in Frappe v14-v16. Covers link field search (search_link), global search, FullTextSearch (Whoosh), SQLiteSearch FTS5 [v15+], Awesomebar customization, search_fields configuration, custom search queries, and website search. Prevents common mistakes with missing search_fields and permission filtering. Keywords: search, search_link, global_search, FullTextSearch, Awesomebar,, search not finding, link field empty, autocomplete not working, global search missing results. search_fields, standard_queries, SQLiteSearch, FTS5, Whoosh.
license
MIT
compatibility
Claude Code, Claude.ai Projects, Claude API. Frappe v14-v16.
metadata
{"author":"OpenAEC-Foundation","version":"3.0"}
Frappe Search System
Four Search Subsystems
Subsystem
Module
Purpose
Real-time?
Link Field Search
frappe.desk.search
Autocomplete in link fields
Yes
Global Search
frappe.utils.global_search
Cross-doctype search (desk + web)
No (15min sync)
FullTextSearch
frappe.search.full_text_search
Whoosh-based index (website)
On rebuild
SQLiteSearch [v15+]
frappe.search.sqlite_search
FTS5 with scoring + spelling
Yes (5min queue)
Decision Tree
What search do you need?
│
├─ Link field autocomplete (user types in a Link field)?
│ ├─ Default behavior sufficient → Configure search_fields on DocType
│ └─ Custom logic needed → standard_queries hook or query parameter
│
├─ Cross-doctype search (user searches for anything)?
│ ├─ Desk users → Global Search (auto-enabled)
│ │ └─ Set in_global_search=1 on important fields
│ └─ Website visitors → web_search() or WebsiteSearch (Whoosh)
│
├─ Custom full-text search for your app [v15+]?
│ └─ SQLiteSearch subclass + sqlite_search hook
│ → Spelling correction, recency boost, custom scoring
│
└─ Awesomebar customization?
└─ Client-side: override build_options or use search dialog
Link Field Search
Configuring search_fields (Most Common Need)
# In DocType JSON or via customize form
{
"search_fields": "customer_name, customer_group",
"title_field": "customer_name",
"show_title_field_in_link": 1
}
ALWAYS set search_fields — Without it, users can only search by name (often a code like CUST-001).
How Link Search Works
User types in link field → calls search_link(doctype, txt)
Searches across: name + title_field + search_fields
Allowed field types: Data, Text, Small Text, Long Text, Link, Select, Autocomplete, Read Only, Text Editor
Prefix matches rank higher than substring matches
Respects enabled/disabled fields automatically
Custom Link Query
# hooks.py — override search for a specific DocType
standard_queries = {
"Customer": "my_app.queries.customer_query"
}
# my_app/queries.py — MUST be @frappe.whitelist()@frappe.whitelist()defcustomer_query(doctype, txt, searchfield, start, page_length, filters,
as_dict=False, reference_doctype=None,
ignore_user_permissions=False):
# Return list of dicts: [{"value": name, "description": label}, ...]return frappe.db.sql("""
SELECT name, customer_name as description
FROM `tabCustomer`
WHERE (name LIKE %(txt)s OR customer_name LIKE %(txt)s)
AND status = 'Active'
ORDER BY customer_name
LIMIT %(start)s, %(page_length)s
""", {"txt": f"%{txt}%", "start": start, "page_length": page_length},
as_dict=True)
Per-Field Query Override
// In Client Script or Form JS
frappe.ui.form.on("Sales Order", {
setup(frm) {
frm.set_query("customer", () => ({
filters: { status: "Active", territory: frm.doc.territory }
}));
}
});
Global Search
Enabling
Set in_global_search = 1 on DocType fields that should be searchable.