Esempio n. 1
0
def packs_search_description(search_query):
    """Search for packs based a string in the description field."""
    query = sanitize_query(search_query["search_input"])
    resource = (r.table("packs").filter(lambda doc: (doc["description"].match(
        "(?i)" + query))).order_by("name").coerce_to("array"))

    return resource
Esempio n. 2
0
async def packs_search_duplicate(conn, name):
    """Search for packs based a string in the name field."""
    query = sanitize_query(name)
    resource = (await r.table("packs").filter(lambda doc: (doc["name"].match(
        "(?i)^" + query + "$"))).order_by("name").coerce_to("array").run(conn))

    return resource
def roles_search_name(search_query):
    """Search for roles based a string int the name field."""
    query = sanitize_query(search_query["search_input"])
    resource = (
        r.table("roles")
        .filter(lambda doc: (doc["name"].match("(?i)" + query)))
        .order_by("name")
        .coerce_to("array")
    )

    return resource