@@ -652,16 +652,28 @@ 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+
673+ SearchResult asOriginal = ft . Search ( index , new Query ( "@first:Jo*" ) ) ;
674+ Assert . Equal ( 0 , asOriginal . TotalResults ) ;
675+ }
676+
665677 [ SkippableTheory ]
666678 [ MemberData ( nameof ( EndpointsFixture . Env . StandaloneOnly ) , MemberType = typeof ( EndpointsFixture . Env ) ) ]
667679 public async Task CreateWithFieldNamesAsync ( string endpointId )
@@ -684,16 +696,26 @@ public async Task CreateWithFieldNamesAsync(string endpointId)
684696 SearchResult noFilters = await ft . SearchAsync ( index , new Query ( ) ) ;
685697 Assert . Equal ( 5 , noFilters . TotalResults ) ;
686698
687- SearchResult asOriginal = await ft . SearchAsync ( index , new Query ( "@first:Jo*" ) ) ;
688- Assert . Equal ( 0 , asOriginal . TotalResults ) ;
689-
690699 SearchResult asAttribute = await ft . SearchAsync ( index , new Query ( "@given:Jo*" ) ) ;
691700 Assert . Equal ( 2 , asAttribute . TotalResults ) ;
692701
693702 SearchResult nonAttribute = await ft . SearchAsync ( index , new Query ( "@last:Rod" ) ) ;
694703 Assert . Equal ( 1 , nonAttribute . TotalResults ) ;
695704 }
696705
706+ [ SkipIfRedis ( Comparison . LessThan , "7.9.0" ) ]
707+ [ MemberData ( nameof ( EndpointsFixture . Env . StandaloneOnly ) , MemberType = typeof ( EndpointsFixture . Env ) ) ]
708+ public async Task FailWhenAttributeNotExistAsync ( string endpointId )
709+ {
710+ IDatabase db = GetCleanDatabase ( endpointId ) ;
711+ var ft = db . FT ( ) ;
712+ Schema sc = new Schema ( ) . AddField ( new TextField ( FieldName . Of ( "first" ) . As ( "given" ) ) )
713+ . AddField ( new TextField ( FieldName . Of ( "last" ) ) ) ;
714+
715+ Assert . True ( await ft . CreateAsync ( index , FTCreateParams . CreateParams ( ) . Prefix ( "student:" , "pupil:" ) , sc ) ) ;
716+ RedisServerException exc = await Assert . ThrowsAsync < RedisServerException > ( async ( ) => await ft . SearchAsync ( index , new Query ( "@first:Jo*" ) ) ) ;
717+ }
718+
697719 [ SkipIfRedis ( Is . Enterprise ) ]
698720 [ MemberData ( nameof ( EndpointsFixture . Env . StandaloneOnly ) , MemberType = typeof ( EndpointsFixture . Env ) ) ]
699721 public void AlterAdd ( string endpointId )
0 commit comments