0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-06-10 05:58:56 +02:00

ircd:Ⓜ️ Start a search namespace; add spec tuple.

This commit is contained in:
Jason Volk 2019-09-14 13:03:05 -07:00
parent c6da5f17d0
commit 5493376731
4 changed files with 64 additions and 0 deletions

View file

@ -80,6 +80,7 @@ namespace ircd::m
#include "fetch.h"
#include "breadcrumb_rooms.h"
#include "media.h"
#include "search.h"
struct ircd::m::init
{

View file

@ -171,4 +171,11 @@ struct ircd::m::name
static constexpr const char *const prev_id {"prev_id"};
static constexpr const char *const deleted {"deleted"};
static constexpr const char *const access_token_id {"access_token_id"};
static constexpr const char *const search_term {"search_term"};
static constexpr const char *const order_by {"order_by"};
static constexpr const char *const event_context {"event_context"};
static constexpr const char *const include_state {"include_state"};
static constexpr const char *const groupings {"groupings"};
static constexpr const char *const filter {"filter"};
};

49
include/ircd/m/search.h Normal file
View file

@ -0,0 +1,49 @@
// Matrix Construct
//
// Copyright (C) Matrix Construct Developers, Authors & Contributors
// Copyright (C) 2016-2019 Jason Volk <jason@zemos.net>
//
// Permission to use, copy, modify, and/or distribute this software for any
// purpose with or without fee is hereby granted, provided that the above
// copyright notice and this permission notice is present in all copies. The
// full license for this software is available in the LICENSE file.
#pragma once
#define HAVE_IRCD_M_SEARCH_H
namespace ircd::m::search
{
struct room_events;
}
struct ircd::m::search::room_events
:json::tuple
<
/// Required. The string to search events for
json::property<name::search_term, json::string>,
/// The keys to search. Defaults to all. One of: ["content.body",
/// "content.name", "content.topic"]
json::property<name::keys, json::string>,
/// This takes a filter
json::property<name::filter, room_event_filter>,
/// The order in which to search for results. By default, this is "rank".
/// One of: ["recent", "rank"]
json::property<name::order_by, json::string>,
/// Configures whether any context for the events returned are included
/// in the response.
json::property<name::event_context, json::object>,
/// Requests the server return the current state for each room returned.
json::property<name::include_state, bool>,
/// Requests that the server partitions the result set based on the
/// provided list of keys.
json::property<name::groupings, json::object>
>
{
using super_type::tuple;
};

View file

@ -150,3 +150,10 @@ constexpr const char *const ircd::m::name::stream_id;
constexpr const char *const ircd::m::name::prev_id;
constexpr const char *const ircd::m::name::deleted;
constexpr const char *const ircd::m::name::access_token_id;
constexpr const char *const ircd::m::name::search_term;
constexpr const char *const ircd::m::name::order_by;
constexpr const char *const ircd::m::name::event_context;
constexpr const char *const ircd::m::name::include_state;
constexpr const char *const ircd::m::name::groupings;
constexpr const char *const ircd::m::name::filter;