@@ -652,16 +652,26 @@ public void CreateWithFieldNames(string endpointId)
652652 SearchResult noFilters = ft . Search ( index , new Query ( ) ) ;
653653 Assert . Equal ( 5 , noFilters . TotalResults ) ;
654654
655- SearchResult asOriginal = ft . Search ( index , new Query ( "@first:Jo*" ) ) ;
656- Assert . Equal ( 0 , asOriginal . TotalResults ) ;
657-
658655 SearchResult asAttribute = ft . Search ( index , new Query ( "@given:Jo*" ) ) ;
659656 Assert . Equal ( 2 , asAttribute . TotalResults ) ;
660657
661658 SearchResult nonAttribute = ft . Search ( index , new Query ( "@last:Rod" ) ) ;
662659 Assert . Equal ( 1 , nonAttribute . TotalResults ) ;
663660 }
664661
662+ [ SkipIfRedis ( Comparison . LessThan , "7.9.0" ) ]
663+ [ MemberData ( nameof ( EndpointsFixture . Env . StandaloneOnly ) , MemberType = typeof ( EndpointsFixture . Env ) ) ]
664+ public void FailWhenAttributeNotExist ( string endpointId )
665+ {
666+ IDatabase db = GetCleanDatabase ( endpointId ) ;
667+ var ft = db . FT ( ) ;
668+ Schema sc = new Schema ( ) . AddField ( new TextField ( FieldName . Of ( "first" ) . As ( "given" ) ) )
669+ . AddField ( new TextField ( FieldName . Of ( "last" ) ) ) ;
670+
671+ Assert . True ( ft . Create ( index , FTCreateParams . CreateParams ( ) . Prefix ( "student:" , "pupil:" ) , sc ) ) ;
672+ RedisServerException exc = Assert . Throws < RedisServerException > ( ( ) => ft . Search ( index , new Query ( "@first:Jo*" ) ) ) ;
673+ }
674+
665675 [ SkippableTheory ]
666676 [ MemberData ( nameof ( EndpointsFixture . Env . StandaloneOnly ) , MemberType = typeof ( EndpointsFixture . Env ) ) ]
667677 public async Task CreateWithFieldNamesAsync ( string endpointId )
@@ -684,16 +694,26 @@ public async Task CreateWithFieldNamesAsync(string endpointId)
684694 SearchResult noFilters = await ft . SearchAsync ( index , new Query ( ) ) ;
685695 Assert . Equal ( 5 , noFilters . TotalResults ) ;
686696
687- SearchResult asOriginal = await ft . SearchAsync ( index , new Query ( "@first:Jo*" ) ) ;
688- Assert . Equal ( 0 , asOriginal . TotalResults ) ;
689-
690697 SearchResult asAttribute = await ft . SearchAsync ( index , new Query ( "@given:Jo*" ) ) ;
691698 Assert . Equal ( 2 , asAttribute . TotalResults ) ;
692699
693700 SearchResult nonAttribute = await ft . SearchAsync ( index , new Query ( "@last:Rod" ) ) ;
694701 Assert . Equal ( 1 , nonAttribute . TotalResults ) ;
695702 }
696703
704+ [ SkipIfRedis ( Comparison . LessThan , "7.9.0" ) ]
705+ [ MemberData ( nameof ( EndpointsFixture . Env . StandaloneOnly ) , MemberType = typeof ( EndpointsFixture . Env ) ) ]
706+ public async Task FailWhenAttributeNotExistAsync ( string endpointId )
707+ {
708+ IDatabase db = GetCleanDatabase ( endpointId ) ;
709+ var ft = db . FT ( ) ;
710+ Schema sc = new Schema ( ) . AddField ( new TextField ( FieldName . Of ( "first" ) . As ( "given" ) ) )
711+ . AddField ( new TextField ( FieldName . Of ( "last" ) ) ) ;
712+
713+ Assert . True ( await ft . CreateAsync ( index , FTCreateParams . CreateParams ( ) . Prefix ( "student:" , "pupil:" ) , sc ) ) ;
714+ RedisServerException exc = await Assert . ThrowsAsync < RedisServerException > ( async ( ) => await ft . SearchAsync ( index , new Query ( "@first:Jo*" ) ) ) ;
715+ }
716+
697717 [ SkipIfRedis ( Is . Enterprise ) ]
698718 [ MemberData ( nameof ( EndpointsFixture . Env . StandaloneOnly ) , MemberType = typeof ( EndpointsFixture . Env ) ) ]
699719 public void AlterAdd ( string endpointId )
@@ -2170,7 +2190,7 @@ public void TestLimit(string endpointId)
21702190 var req = new AggregationRequest ( "*" ) . SortBy ( "@t1" ) . Limit ( 1 ) ;
21712191 var res = ft . Aggregate ( "idx" , req ) ;
21722192
2173- Assert . Equal ( 1 , res . GetResults ( ) . Count ) ;
2193+ Assert . Single ( res . GetResults ( ) ) ;
21742194 Assert . Equal ( "a" , res . GetResults ( ) [ 0 ] [ "t1" ] . ToString ( ) ) ;
21752195 }
21762196
@@ -2190,7 +2210,7 @@ public async Task TestLimitAsync(string endpointId)
21902210 var req = new AggregationRequest ( "*" ) . SortBy ( "@t1" ) . Limit ( 1 , 1 ) ;
21912211 var res = await ft . AggregateAsync ( "idx" , req ) ;
21922212
2193- Assert . Equal ( 1 , res . GetResults ( ) . Count ) ;
2213+ Assert . Single ( res . GetResults ( ) ) ;
21942214 Assert . Equal ( "b" , res . GetResults ( ) [ 0 ] [ "t1" ] . ToString ( ) ) ;
21952215 }
21962216
0 commit comments