File tree Expand file tree Collapse file tree 2 files changed +11
-8
lines changed
Tests/Nest.Tests.Integration/Search/NamedFilter Expand file tree Collapse file tree 2 files changed +11
-8
lines changed Original file line number Diff line number Diff line change @@ -16,11 +16,10 @@ public interface IHit<out T> where T : class
1616 string Type { get ; }
1717 string Version { get ; }
1818 string Id { get ; }
19-
2019 IEnumerable < object > Sorts { get ; }
21-
2220 HighlightFieldDictionary Highlights { get ; }
2321 Explanation Explanation { get ; }
22+ IEnumerable < string > MatchedQueries { get ; }
2423 }
2524
2625 [ JsonObject ]
@@ -76,5 +75,7 @@ public HighlightFieldDictionary Highlights
7675 [ JsonProperty ( PropertyName = "_explanation" ) ]
7776 public Explanation Explanation { get ; internal set ; }
7877
78+ [ JsonProperty ( PropertyName = "matched_queries" ) ]
79+ public IEnumerable < string > MatchedQueries { get ; internal set ; }
7980 }
8081}
Original file line number Diff line number Diff line change 1- using System . Linq ;
1+ using FluentAssertions ;
2+ using System . Linq ;
23using Nest . Tests . MockData ;
34using Nest . Tests . MockData . Domain ;
45using NUnit . Framework ;
@@ -22,11 +23,12 @@ public void SimpleNamedFilter()
2223 || f . Name ( "myfilter2" ) . Terms ( p => p . Name . Suffix ( "sort" ) , new [ ] { "nest" } )
2324 )
2425 ) ;
25- Assert . True ( queryResults . IsValid ) ;
26- //Assert.True(queryResults.Documents.Any());
27- //Assert matched_filters is returned
28- //Possible ES bug
29- //https://github.com/elasticsearch/elasticsearch/issues/3097
26+ queryResults . IsValid . Should ( ) . BeTrue ( ) ;
27+ foreach ( var hit in queryResults . Hits )
28+ {
29+ hit . MatchedQueries . Should ( ) . NotBeNull ( ) . And . NotBeEmpty ( ) ;
30+ hit . MatchedQueries . Any ( mq => mq . Contains ( "myfilter" ) || mq . Contains ( "myfilter2" ) ) ;
31+ }
3032 }
3133 }
3234
You can’t perform that action at this time.
0 commit comments