File tree Expand file tree Collapse file tree 1 file changed +11
-2
lines changed Expand file tree Collapse file tree 1 file changed +11
-2
lines changed Original file line number Diff line number Diff line change @@ -98,17 +98,26 @@ public class FunctionScoreQueryDescriptor<T> : IFunctionScoreQuery where T : cla
9898
9999 string IQuery . Name { get ; set ; }
100100
101+ private bool _forcedConditionless = false ;
102+
101103 bool IQuery . IsConditionless
102104 {
103105 get
104106 {
105- return ( Self . Query == null || Self . Query . IsConditionless )
107+ return _forcedConditionless || ( ( Self . Query == null || Self . Query . IsConditionless )
106108 && Self . RandomScore == null
107109 && Self . ScriptScore == null
108- && ! Self . Functions . HasAny ( ) ;
110+ && ! Self . Functions . HasAny ( ) ) ;
109111 }
110112 }
111113
114+ public FunctionScoreQueryDescriptor < T > ConditionlessWhen ( bool isConditionless )
115+ {
116+ this . _forcedConditionless = isConditionless ;
117+ return this ;
118+ }
119+
120+
112121 public FunctionScoreQueryDescriptor < T > Name ( string name )
113122 {
114123 Self . Name = name ;
You can’t perform that action at this time.
0 commit comments