use super::Query;
use crate::util::*;
#[derive(Debug, Clone, PartialEq, Serialize, Default)]
#[serde(remote = "Self")]
pub struct MatchNoneQuery {
#[serde(skip_serializing_if = "ShouldSkip::should_skip")]
boost: Option<f32>,
#[serde(skip_serializing_if = "ShouldSkip::should_skip")]
_name: Option<String>,
}
impl Query {
pub fn match_none() -> MatchNoneQuery {
MatchNoneQuery::default()
}
}
impl MatchNoneQuery {
add_boost_and_name!();
}
serialize_with_root!("match_none": MatchNoneQuery);
impl ShouldSkip for MatchNoneQuery {}
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn serialization() {
assert_serialize_query(Query::match_none(), json!({"match_none": {} }));
assert_serialize_query(
Query::match_none().boost(2).name("test"),
json!({ "match_none": { "boost": 2.0, "_name": "test" } }),
);
}
}