@@ -32,7 +32,22 @@ const THINGS_GQL: &str = r#"
32
32
]
33
33
}
34
34
]
35
+ ) @fulltext(
36
+ name: "nullableStringsSearch"
37
+ language: en
38
+ algorithm: rank
39
+ include: [
40
+ {
41
+ entity: "NullableStrings",
42
+ fields: [
43
+ { name: "name"},
44
+ { name: "description"},
45
+ { name: "test"},
46
+ ]
47
+ }
48
+ ]
35
49
)
50
+
36
51
type Thing @entity {
37
52
id: ID!
38
53
bigThing: Thing!
@@ -87,6 +102,13 @@ const THINGS_GQL: &str = r#"
87
102
favorite_color: Color,
88
103
drinks: [String!]
89
104
}
105
+
106
+ type NullableStrings @entity {
107
+ id: ID!,
108
+ name: String,
109
+ description: String,
110
+ test: String
111
+ }
90
112
"# ;
91
113
92
114
const SCHEMA_NAME : & str = "layout" ;
@@ -143,6 +165,12 @@ lazy_static! {
143
165
entity. set( "__typename" , "Scalar" ) ;
144
166
entity
145
167
} ;
168
+ static ref EMPTY_NULLABLESTRINGS_ENTITY : Entity = {
169
+ let mut entity = Entity :: new( ) ;
170
+ entity. set( "id" , "one" ) ;
171
+ entity. set( "__typename" , "NullableStrings" ) ;
172
+ entity
173
+ } ;
146
174
}
147
175
148
176
/// Removes test data from the database behind the store.
@@ -418,6 +446,27 @@ fn find() {
418
446
} ) ;
419
447
}
420
448
449
+ #[ test]
450
+ fn insert_null_fulltext_fields ( ) {
451
+ run_test ( |conn, layout| -> Result < ( ) , ( ) > {
452
+ insert_entity (
453
+ & conn,
454
+ & layout,
455
+ "NullableStrings" ,
456
+ EMPTY_NULLABLESTRINGS_ENTITY . clone ( ) ,
457
+ ) ;
458
+
459
+ // Find entity with null string values
460
+ let entity = layout
461
+ . find ( conn, "NullableStrings" , "one" , BLOCK_NUMBER_MAX )
462
+ . expect ( "Failed to read NullableStrings[one]" )
463
+ . unwrap ( ) ;
464
+ assert_entity_eq ! ( scrub( & * EMPTY_NULLABLESTRINGS_ENTITY ) , entity) ;
465
+
466
+ Ok ( ( ) )
467
+ } ) ;
468
+ }
469
+
421
470
#[ test]
422
471
fn update ( ) {
423
472
run_test ( |conn, layout| -> Result < ( ) , ( ) > {
0 commit comments