# Copyright (c) 2020, InfluxFramework LLC
# License: MIT. See LICENSE

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


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