aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/parse.rs23
1 files changed, 18 insertions, 5 deletions
diff --git a/src/parse.rs b/src/parse.rs
index 338ec64..c2cb356 100644
--- a/src/parse.rs
+++ b/src/parse.rs
@@ -205,13 +205,13 @@ pub struct ApiQuery {
#[serde(skip_serializing_if = "Option::is_none")]
ids: Option<IdsQuery>,
#[serde(skip_serializing_if = "Option::is_none")]
- wildcard: Option<HashMap<String, TermQueryOrString>>, // also works for wildcard
+ wildcard: Option<HashMap<String, TermQueryOrValue>>, // also works for wildcard
#[serde(skip_serializing_if = "Option::is_none")]
- prefix: Option<HashMap<String, TermQueryOrString>>, // also works for prefix query
+ prefix: Option<HashMap<String, TermQueryOrValue>>, // also works for prefix query
#[serde(skip_serializing_if = "Option::is_none")]
range: Option<HashMap<String, RangeQuery>>,
#[serde(skip_serializing_if = "Option::is_none")]
- term: Option<HashMap<String, TermQueryOrString>>,
+ term: Option<HashMap<String, TermQueryOrValue>>,
#[serde(skip_serializing_if = "Option::is_none")]
// TODO: boost in terms query
terms: Option<HashMap<String, Vec<String>>>,
@@ -401,15 +401,18 @@ pub struct IdsQuery {
#[derive(Serialize, Deserialize, Debug)]
#[serde(deny_unknown_fields)]
#[serde(untagged)]
-pub enum TermQueryOrString {
+pub enum TermQueryOrValue {
String(String),
+ Int(u64),
+ Float(f64),
+ Boolean(bool),
Object(TermQuery),
}
#[derive(Serialize, Deserialize, Debug)]
#[serde(deny_unknown_fields)]
pub struct TermQuery {
- value: String,
+ value: StringOrNumOrBool,
#[serde(skip_serializing_if = "Option::is_none")]
rewrite: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
@@ -428,6 +431,16 @@ pub enum StringOrNum {
#[derive(Serialize, Deserialize, Debug)]
#[serde(deny_unknown_fields)]
#[serde(untagged)]
+pub enum StringOrNumOrBool {
+ String(String),
+ Int(u64),
+ Float(f64),
+ Boolean(bool),
+}
+
+#[derive(Serialize, Deserialize, Debug)]
+#[serde(deny_unknown_fields)]
+#[serde(untagged)]
pub enum Num {
Int(u64),
Float(f64),