@@ -18,6 +18,7 @@ use std::convert::TryFrom;
1818use anyhow:: bail;
1919use base64:: prelude:: { BASE64_STANDARD , Engine } ;
2020use once_cell:: sync:: Lazy ;
21+ use quickwit_common:: true_fn;
2122use regex:: Regex ;
2223use serde:: { Deserialize , Serialize } ;
2324use serde_json:: Value as JsonValue ;
@@ -26,8 +27,8 @@ use tantivy::schema::{
2627 TextOptions , Type ,
2728} ;
2829
30+ use super :: FieldMappingType ;
2931use super :: date_time_type:: QuickwitDateTimeOptions ;
30- use super :: { FieldMappingType , default_as_true} ;
3132use crate :: doc_mapper:: field_mapping_type:: QuickwitFieldType ;
3233use crate :: { Cardinality , QW_RESERVED_FIELD_NAMES } ;
3334
@@ -85,13 +86,13 @@ pub struct QuickwitNumericOptions {
8586 #[ serde( default ) ]
8687 #[ serde( skip_serializing_if = "Option::is_none" ) ]
8788 pub description : Option < String > ,
88- #[ serde( default = "default_as_true " ) ]
89+ #[ serde( default = "true_fn " ) ]
8990 pub stored : bool ,
90- #[ serde( default = "default_as_true " ) ]
91+ #[ serde( default = "true_fn " ) ]
9192 pub indexed : bool ,
9293 #[ serde( default ) ]
9394 pub fast : bool ,
94- #[ serde( default = "default_as_true " ) ]
95+ #[ serde( default = "true_fn " ) ]
9596 pub coerce : bool ,
9697 #[ serde( default ) ]
9798 pub output_format : NumericOutputFormat ,
@@ -116,9 +117,9 @@ pub struct QuickwitBoolOptions {
116117 #[ serde( default ) ]
117118 #[ serde( skip_serializing_if = "Option::is_none" ) ]
118119 pub description : Option < String > ,
119- #[ serde( default = "default_as_true " ) ]
120+ #[ serde( default = "true_fn " ) ]
120121 pub stored : bool ,
121- #[ serde( default = "default_as_true " ) ]
122+ #[ serde( default = "true_fn " ) ]
122123 pub indexed : bool ,
123124 #[ serde( default ) ]
124125 pub fast : bool ,
@@ -144,10 +145,10 @@ pub struct QuickwitBytesOptions {
144145 #[ serde( skip_serializing_if = "Option::is_none" ) ]
145146 pub description : Option < String > ,
146147 /// If true, the field will be stored in the doc store.
147- #[ serde( default = "default_as_true " ) ]
148+ #[ serde( default = "true_fn " ) ]
148149 pub stored : bool ,
149150 /// If true, the field will be indexed.
150- #[ serde( default = "default_as_true " ) ]
151+ #[ serde( default = "true_fn " ) ]
151152 pub indexed : bool ,
152153 /// If true, the field will be stored in columnar format.
153154 #[ serde( default ) ]
@@ -245,9 +246,9 @@ pub struct QuickwitIpAddrOptions {
245246 #[ serde( default ) ]
246247 #[ serde( skip_serializing_if = "Option::is_none" ) ]
247248 pub description : Option < String > ,
248- #[ serde( default = "default_as_true " ) ]
249+ #[ serde( default = "true_fn " ) ]
249250 pub stored : bool ,
250- #[ serde( default = "default_as_true " ) ]
251+ #[ serde( default = "true_fn " ) ]
251252 pub indexed : bool ,
252253 #[ serde( default ) ]
253254 pub fast : bool ,
@@ -433,7 +434,7 @@ pub struct QuickwitTextOptions {
433434 deserializer = TextIndexingOptions :: from_parts_text,
434435 serializer = TextIndexingOptions :: to_parts_text,
435436 fields = (
436- #[ serde( default = "default_as_true " ) ]
437+ #[ serde( default = "true_fn " ) ]
437438 pub indexed: bool ,
438439 #[ serde( default ) ]
439440 #[ serde( skip_serializing_if = "Option::is_none" ) ]
@@ -447,7 +448,7 @@ pub struct QuickwitTextOptions {
447448 ) ,
448449 ) ]
449450 pub indexing_options : Option < TextIndexingOptions > ,
450- #[ serde( default = "default_as_true " ) ]
451+ #[ serde( default = "true_fn " ) ]
451452 pub stored : bool ,
452453 #[ serde( default ) ]
453454 pub fast : FastFieldOptions ,
@@ -577,7 +578,7 @@ pub struct QuickwitJsonOptions {
577578 serializer = TextIndexingOptions :: to_parts_json,
578579 fields = (
579580 /// If true, all of the element in the json object will be indexed.
580- #[ serde( default = "default_as_true " ) ]
581+ #[ serde( default = "true_fn " ) ]
581582 pub indexed: bool ,
582583 /// Sets the tokenize that should be used with the text fields in the
583584 /// json object.
@@ -597,10 +598,10 @@ pub struct QuickwitJsonOptions {
597598 /// Options for indexing text in a Json field.
598599 pub indexing_options : Option < TextIndexingOptions > ,
599600 /// If true, the field will be stored in the doc store.
600- #[ serde( default = "default_as_true " ) ]
601+ #[ serde( default = "true_fn " ) ]
601602 pub stored : bool ,
602603 /// If true, the '.' in json keys will be expanded.
603- #[ serde( default = "default_as_true " ) ]
604+ #[ serde( default = "true_fn " ) ]
604605 pub expand_dots : bool ,
605606 /// If true, the json object will be stored in columnar format.
606607 #[ serde( default ) ]
0 commit comments