summa_core/metrics/
label.rs1use summa_proto::proto;
2
3pub trait ToLabel {
5 fn to_label(&self) -> String;
6}
7
8impl ToLabel for proto::query::Query {
9 fn to_label(&self) -> String {
10 match &self {
11 proto::query::Query::All(_) => "all",
12 proto::query::Query::Boolean(_) => "boolean",
13 proto::query::Query::Empty(_) => "empty",
14 proto::query::Query::Match(_) => "match",
15 proto::query::Query::Range(_) => "range",
16 proto::query::Query::Boost(_) => "boost",
17 proto::query::Query::Regex(_) => "regex",
18 proto::query::Query::Phrase(_) => "phrase",
19 proto::query::Query::Term(_) => "term",
20 proto::query::Query::MoreLikeThis(_) => "more_like_this",
21 proto::query::Query::DisjunctionMax(_) => "disjunction_max",
22 proto::query::Query::Exists(_) => "exists",
23 }
24 .to_owned()
25 }
26}