# Copyright (c) 2020, JINGROW and Contributors
# License: MIT. See LICENSE

import jingrow
from jingrow.search.full_text_search import FullTextSearch
from jingrow.search.website_search import WebsiteSearch
from jingrow.utils import cint


@jingrow.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)
