# Copyright (c) 2020, Xhive Global Ltd. and Contributors
# License: MIT. See LICENSE

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


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