@@ -5,7 +5,7 @@ pub mod ip;
5
5
pub mod number;
6
6
pub mod text;
7
7
8
- use std:: { collections :: HashMap , path:: Path } ;
8
+ use std:: path:: Path ;
9
9
10
10
use color_eyre:: eyre:: Result ;
11
11
use serde:: { Deserialize , Serialize } ;
@@ -100,6 +100,8 @@ pub enum FieldType {
100
100
101
101
#[ derive( Debug , Clone , Serialize , Deserialize ) ]
102
102
pub struct FieldsConfig {
103
+ pub name : String ,
104
+
103
105
#[ serde( rename = "type" ) ]
104
106
pub type_ : FieldType ,
105
107
}
@@ -123,7 +125,7 @@ impl FieldsConfig {
123
125
#[ derive( Debug , Clone , Serialize , Deserialize , Default ) ]
124
126
pub struct IndexSchema {
125
127
#[ serde( default ) ]
126
- pub fields : HashMap < String , FieldsConfig > ,
128
+ pub fields : Vec < FieldsConfig > ,
127
129
128
130
#[ serde( default ) ]
129
131
#[ serde( skip_serializing_if = "Option::is_none" ) ]
@@ -134,9 +136,8 @@ impl IndexSchema {
134
136
pub fn get_indexed_fields ( & self ) -> Vec < String > {
135
137
self . fields
136
138
. iter ( )
137
- . filter ( |( _, v) | v. is_indexed ( ) )
138
- . map ( |( k, _) | k)
139
- . cloned ( )
139
+ . filter ( |x| x. is_indexed ( ) )
140
+ . map ( |x| x. name . clone ( ) )
140
141
. collect ( )
141
142
}
142
143
}
0 commit comments