@@ -652,16 +652,26 @@ public void CreateWithFieldNames(string endpointId)
652
652
SearchResult noFilters = ft . Search ( index , new Query ( ) ) ;
653
653
Assert . Equal ( 5 , noFilters . TotalResults ) ;
654
654
655
- SearchResult asOriginal = ft . Search ( index , new Query ( "@first:Jo*" ) ) ;
656
- Assert . Equal ( 0 , asOriginal . TotalResults ) ;
657
-
658
655
SearchResult asAttribute = ft . Search ( index , new Query ( "@given:Jo*" ) ) ;
659
656
Assert . Equal ( 2 , asAttribute . TotalResults ) ;
660
657
661
658
SearchResult nonAttribute = ft . Search ( index , new Query ( "@last:Rod" ) ) ;
662
659
Assert . Equal ( 1 , nonAttribute . TotalResults ) ;
663
660
}
664
661
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
+
665
675
[ SkippableTheory ]
666
676
[ MemberData ( nameof ( EndpointsFixture . Env . StandaloneOnly ) , MemberType = typeof ( EndpointsFixture . Env ) ) ]
667
677
public async Task CreateWithFieldNamesAsync ( string endpointId )
@@ -684,16 +694,26 @@ public async Task CreateWithFieldNamesAsync(string endpointId)
684
694
SearchResult noFilters = await ft . SearchAsync ( index , new Query ( ) ) ;
685
695
Assert . Equal ( 5 , noFilters . TotalResults ) ;
686
696
687
- SearchResult asOriginal = await ft . SearchAsync ( index , new Query ( "@first:Jo*" ) ) ;
688
- Assert . Equal ( 0 , asOriginal . TotalResults ) ;
689
-
690
697
SearchResult asAttribute = await ft . SearchAsync ( index , new Query ( "@given:Jo*" ) ) ;
691
698
Assert . Equal ( 2 , asAttribute . TotalResults ) ;
692
699
693
700
SearchResult nonAttribute = await ft . SearchAsync ( index , new Query ( "@last:Rod" ) ) ;
694
701
Assert . Equal ( 1 , nonAttribute . TotalResults ) ;
695
702
}
696
703
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
+
697
717
[ SkipIfRedis ( Is . Enterprise ) ]
698
718
[ MemberData ( nameof ( EndpointsFixture . Env . StandaloneOnly ) , MemberType = typeof ( EndpointsFixture . Env ) ) ]
699
719
public void AlterAdd ( string endpointId )
0 commit comments