@@ -8,94 +8,94 @@ namespace Nest
88{
99 public interface ISearchResponse < T > : IResponse where T : class
1010 {
11- /// <summary>
12- /// Gets the meta data about the shards on which the search query was executed.
13- /// </summary>
14- ShardsMetaData Shards { get ; }
15-
16- /// <summary>
17- /// Gets the meta data about the hits that match the search query criteria.
18- /// </summary>
19- HitsMetaData < T > HitsMetaData { get ; }
20-
21- /// <summary>
22- /// Gets the collection of aggregations
23- /// </summary>
24- IReadOnlyDictionary < string , IAggregate > Aggregations { get ; }
25-
26- /// <summary>
27- /// Gets the results of profiling the search query. Has a value only when
28- /// <see cref="ISearchRequest.Profile"/> is set to <c>true</c> on the search request.
29- /// </summary>
30- Profile Profile { get ; }
31-
32- /// <summary>
33- /// Gets the aggregations helper that can be used to more easily handle aggregation
34- /// results.
35- /// </summary>
36- AggregationsHelper Aggs { get ; }
37-
38- /// <summary>
39- /// Gets the suggester results.
40- /// </summary>
41- IReadOnlyDictionary < string , Suggest < T > [ ] > Suggest { get ; }
42-
43- /// <summary>
44- /// Time in milliseconds for Elasticsearch to execute the search
45- /// </summary>
46- long Took { get ; }
47-
48- /// <summary>
49- /// Gets a value indicating whether the search timed out or not
50- /// </summary>
51- bool TimedOut { get ; }
52-
53- /// <summary>
54- /// Gets a value indicating whether the search was terminated early
55- /// </summary>
56- bool TerminatedEarly { get ; }
57-
58- /// <summary>
59- /// Gets the scroll id which can be passed to the Scroll API in order to retrieve the next batch
60- /// of results. Has a value only when <see cref="SearchRequest{T}.Scroll"/> is specified on the
61- /// search request
62- /// </summary>
63- string ScrollId { get ; }
64-
65- /// <summary>
66- /// Gets the total number of documents matching the search query criteria
67- /// </summary>
68- long Total { get ; }
69-
70- /// <summary>
71- /// Gets the maximum score for documents matching the search query criteria
72- /// </summary>
73- double MaxScore { get ; }
74-
75- /// <summary>
76- /// Gets the documents inside the hits, by deserializing <see cref="IHitMetadata{T}.Source"/> into T.
77- /// <para>NOTE: if you use <see cref="ISearchRequest.StoredFields"/> on the search request,
78- /// <see cref="Documents"/> will be empty and you should use <see cref="Fields"/>
79- /// instead to get the field values. As an alternative to
80- /// <see cref="Fields"/>, try source filtering using <see cref="ISearchRequest.Source"/> on the
81- /// search request to return <see cref="Documents"/> with partial fields selected
82- /// </para>
83- /// </summary>
84- IReadOnlyCollection < T > Documents { get ; }
85-
86- /// <summary>
87- /// Gets the collection of hits that matched the query
88- /// </summary>
89- /// <value>
90- /// The hits.
91- /// </value>
92- IReadOnlyCollection < IHit < T > > Hits { get ; }
93-
94- /// <summary>
95- /// Gets the field values inside the hits, when the search request uses
96- /// <see cref="SearchRequest{T}.StoredFields"/>.
97- /// </summary>
98- IReadOnlyCollection < FieldValues > Fields { get ; }
11+ /// <summary>
12+ /// Gets the meta data about the shards on which the search query was executed.
13+ /// </summary>
14+ ShardsMetaData Shards { get ; }
15+
16+ /// <summary>
17+ /// Gets the meta data about the hits that match the search query criteria.
18+ /// </summary>
19+ HitsMetaData < T > HitsMetaData { get ; }
20+
21+ /// <summary>
22+ /// Gets the collection of aggregations
23+ /// </summary>
24+ IReadOnlyDictionary < string , IAggregate > Aggregations { get ; }
25+
26+ /// <summary>
27+ /// Gets the results of profiling the search query. Has a value only when
28+ /// <see cref="ISearchRequest.Profile"/> is set to <c>true</c> on the search request.
29+ /// </summary>
30+ Profile Profile { get ; }
31+
32+ /// <summary>
33+ /// Gets the aggregations helper that can be used to more easily handle aggregation
34+ /// results.
35+ /// </summary>
36+ AggregationsHelper Aggs { get ; }
37+
38+ /// <summary>
39+ /// Gets the suggester results.
40+ /// </summary>
41+ IReadOnlyDictionary < string , Suggest < T > [ ] > Suggest { get ; }
42+
43+ /// <summary>
44+ /// Time in milliseconds for Elasticsearch to execute the search
45+ /// </summary>
46+ long Took { get ; }
47+
48+ /// <summary>
49+ /// Gets a value indicating whether the search timed out or not
50+ /// </summary>
51+ bool TimedOut { get ; }
52+
53+ /// <summary>
54+ /// Gets a value indicating whether the search was terminated early
55+ /// </summary>
56+ bool TerminatedEarly { get ; }
57+
58+ /// <summary>
59+ /// Gets the scroll id which can be passed to the Scroll API in order to retrieve the next batch
60+ /// of results. Has a value only when <see cref="SearchRequest{T}.Scroll"/> is specified on the
61+ /// search request
62+ /// </summary>
63+ string ScrollId { get ; }
64+
65+ /// <summary>
66+ /// Gets the total number of documents matching the search query criteria
67+ /// </summary>
68+ long Total { get ; }
69+
70+ /// <summary>
71+ /// Gets the maximum score for documents matching the search query criteria
72+ /// </summary>
73+ double MaxScore { get ; }
74+
75+ /// <summary>
76+ /// Gets the documents inside the hits, by deserializing <see cref="IHitMetadata{T}.Source"/> into T.
77+ /// <para>NOTE: if you use <see cref="ISearchRequest.StoredFields"/> on the search request,
78+ /// <see cref="Documents"/> will be empty and you should use <see cref="Fields"/>
79+ /// instead to get the field values. As an alternative to
80+ /// <see cref="Fields"/>, try source filtering using <see cref="ISearchRequest.Source"/> on the
81+ /// search request to return <see cref="Documents"/> with partial fields selected
82+ /// </para>
83+ /// </summary>
84+ IReadOnlyCollection < T > Documents { get ; }
85+
86+ /// <summary>
87+ /// Gets the collection of hits that matched the query
88+ /// </summary>
89+ /// <value>
90+ /// The hits.
91+ /// </value>
92+ IReadOnlyCollection < IHit < T > > Hits { get ; }
93+
94+ /// <summary>
95+ /// Gets the field values inside the hits, when the search request uses
96+ /// <see cref="SearchRequest{T}.StoredFields"/>.
97+ /// </summary>
98+ IReadOnlyCollection < FieldValues > Fields { get ; }
9999 }
100100
101101 [ JsonObject ]
@@ -115,6 +115,7 @@ public class SearchResponse<T> : ResponseBase, ISearchResponse<T> where T : clas
115115 public Profile Profile { get ; internal set ; }
116116
117117 private AggregationsHelper _agg ;
118+
118119 [ JsonIgnore ]
119120 public AggregationsHelper Aggs => _agg ?? ( _agg = new AggregationsHelper ( this . Aggregations ) ) ;
120121
@@ -147,6 +148,7 @@ public class SearchResponse<T> : ResponseBase, ISearchResponse<T> where T : clas
147148 public double MaxScore => this . HitsMetaData ? . MaxScore ?? 0 ;
148149
149150 private IReadOnlyCollection < T > _documents ;
151+
150152 /// <inheritdoc/>
151153 [ JsonIgnore ]
152154 public IReadOnlyCollection < T > Documents =>
@@ -155,6 +157,7 @@ public class SearchResponse<T> : ResponseBase, ISearchResponse<T> where T : clas
155157 . ToList ( ) ) ;
156158
157159 private IReadOnlyCollection < IHit < T > > _hits ;
160+
158161 [ JsonIgnore ]
159162 public IReadOnlyCollection < IHit < T > > Hits =>
160163 this . _hits ?? ( this . _hits = this . HitsMetaData ? . Hits ?? EmptyReadOnly < IHit < T > > . Collection ) ;
@@ -163,9 +166,8 @@ public class SearchResponse<T> : ResponseBase, ISearchResponse<T> where T : clas
163166
164167 /// <inheritdoc/>
165168 public IReadOnlyCollection < FieldValues > Fields =>
166- this . _fields ?? ( this . _fields = this . Hits
167- . Select ( h => h . Fields )
168- . ToList ( ) ) ;
169-
169+ this . _fields ?? ( this . _fields = this . Hits
170+ . Select ( h => h . Fields )
171+ . ToList ( ) ) ;
170172 }
171173}
0 commit comments