@@ -47,8 +47,8 @@ protected override void WrapInContainer(IQueryContainer container)
4747 {
4848 container . CommonTerms = this ;
4949 }
50-
5150 bool IQuery . IsConditionless { get { return false ; } }
51+
5252 PropertyPathMarker IFieldNameQuery . GetFieldName ( )
5353 {
5454 return this . Field ;
@@ -59,6 +59,7 @@ void IFieldNameQuery.SetFieldName(string fieldName)
5959 this . Field = fieldName ;
6060 }
6161
62+ public string Name { get ; set ; }
6263 public string Query { get ; set ; }
6364 public PropertyPathMarker Field { get ; set ; }
6465 public double ? CutoffFrequency { get ; set ; }
@@ -72,6 +73,8 @@ void IFieldNameQuery.SetFieldName(string fieldName)
7273
7374 public class CommonTermsQueryDescriptor < T > : ICommonTermsQuery where T : class
7475 {
76+ private ICommonTermsQuery Self { get { return this ; } }
77+
7578 string ICommonTermsQuery . Query { get ; set ; }
7679
7780 PropertyPathMarker ICommonTermsQuery . Field { get ; set ; }
@@ -90,77 +93,85 @@ public class CommonTermsQueryDescriptor<T> : ICommonTermsQuery where T : class
9093
9194 bool ? ICommonTermsQuery . DisableCoord { get ; set ; }
9295
96+ string IQuery . Name { get ; set ; }
97+
9398 bool IQuery . IsConditionless
9499 {
95100 get
96101 {
97- return ( ( ICommonTermsQuery ) this ) . Field . IsConditionless ( ) || ( ( ICommonTermsQuery ) this ) . Query . IsNullOrEmpty ( ) ;
102+ return Self . Field . IsConditionless ( ) || Self . Query . IsNullOrEmpty ( ) ;
98103 }
99104 }
100105 void IFieldNameQuery . SetFieldName ( string fieldName )
101106 {
102- ( ( ICommonTermsQuery ) this ) . Field = fieldName ;
107+ Self . Field = fieldName ;
103108 }
104109 PropertyPathMarker IFieldNameQuery . GetFieldName ( )
105110 {
106- return ( ( ICommonTermsQuery ) this ) . Field ;
111+ return Self . Field ;
112+ }
113+
114+ public CommonTermsQueryDescriptor < T > Name ( string name )
115+ {
116+ Self . Name = name ;
117+ return this ;
107118 }
108119
109120 public CommonTermsQueryDescriptor < T > OnField ( string field )
110121 {
111- ( ( ICommonTermsQuery ) this ) . Field = field ;
122+ Self . Field = field ;
112123 return this ;
113124 }
114125 public CommonTermsQueryDescriptor < T > OnField ( Expression < Func < T , object > > objectPath )
115126 {
116- ( ( ICommonTermsQuery ) this ) . Field = objectPath ;
127+ Self . Field = objectPath ;
117128 return this ;
118129 }
119130
120131 public CommonTermsQueryDescriptor < T > Query ( string query )
121132 {
122- ( ( ICommonTermsQuery ) this ) . Query = query ;
133+ Self . Query = query ;
123134 return this ;
124135 }
125136 public CommonTermsQueryDescriptor < T > LowFrequencyOperator ( Operator op )
126137 {
127- ( ( ICommonTermsQuery ) this ) . LowFrequencyOperator = op ;
138+ Self . LowFrequencyOperator = op ;
128139 return this ;
129140 }
130141 public CommonTermsQueryDescriptor < T > HighFrequencyOperator ( Operator op )
131142 {
132- ( ( ICommonTermsQuery ) this ) . HighFrequencyOperator = op ;
143+ Self . HighFrequencyOperator = op ;
133144 return this ;
134145 }
135146 public CommonTermsQueryDescriptor < T > Analyzer ( string analyzer )
136147 {
137- ( ( ICommonTermsQuery ) this ) . Analyzer = analyzer ;
148+ Self . Analyzer = analyzer ;
138149 return this ;
139150 }
140151
141152 public CommonTermsQueryDescriptor < T > CutoffFrequency ( double cutOffFrequency )
142153 {
143- ( ( ICommonTermsQuery ) this ) . CutoffFrequency = cutOffFrequency ;
154+ Self . CutoffFrequency = cutOffFrequency ;
144155 return this ;
145156 }
146157 public CommonTermsQueryDescriptor < T > MinimumShouldMatch ( string minimumShouldMatch )
147158 {
148- ( ( ICommonTermsQuery ) this ) . MinimumShouldMatch = minimumShouldMatch ;
159+ Self . MinimumShouldMatch = minimumShouldMatch ;
149160 return this ;
150161 }
151162 public CommonTermsQueryDescriptor < T > MinimumShouldMatch ( int minimumShouldMatch )
152163 {
153- ( ( ICommonTermsQuery ) this ) . MinimumShouldMatch = minimumShouldMatch . ToString ( CultureInfo . InvariantCulture ) ;
164+ Self . MinimumShouldMatch = minimumShouldMatch . ToString ( CultureInfo . InvariantCulture ) ;
154165 return this ;
155166 }
156167 public CommonTermsQueryDescriptor < T > Boost ( double boost )
157168 {
158- ( ( ICommonTermsQuery ) this ) . Boost = boost ;
169+ Self . Boost = boost ;
159170 return this ;
160171 }
161172 public CommonTermsQueryDescriptor < T > DisableCoord ( bool disable = true )
162173 {
163- ( ( ICommonTermsQuery ) this ) . DisableCoord = disable ;
174+ Self . DisableCoord = disable ;
164175 return this ;
165176 }
166177
0 commit comments