- Abstract SQLiteSearch base class with full-text search - Spelling correction, recency boosting, and custom scoring - Supports search filtering and configurable document indexing - hooks for auto-indexing - build index after migrate - build index (if not exists) every 15 mins - update doc index on_update - remove doc index on_trash
15 lines
496 B
Python
15 lines
496 B
Python
# Copyright (c) 2020, Frappe Technologies Pvt. Ltd. and Contributors
|
|
# License: MIT. See LICENSE
|
|
|
|
import frappe
|
|
from frappe.search.full_text_search import FullTextSearch
|
|
from frappe.search.sqlite_search import SQLiteSearch
|
|
from frappe.search.website_search import WebsiteSearch
|
|
from frappe.utils import cint
|
|
|
|
|
|
@frappe.whitelist(allow_guest=True)
|
|
def web_search(query, scope=None, limit=20):
|
|
limit = cint(limit)
|
|
ws = WebsiteSearch(index_name="web_routes")
|
|
return ws.search(query, scope, limit)
|