@@ -16,8 +16,17 @@ public interface ISpanNotQuery : ISpanSubQuery
16
16
[ JsonProperty ( PropertyName = "exclude" ) ]
17
17
ISpanQuery Exclude { get ; set ; }
18
18
19
- [ JsonProperty ( PropertyName = "boost" ) ]
20
- double ? Boost { get ; set ; }
19
+ [ JsonProperty ( PropertyName = "boost" ) ]
20
+ double ? Boost { get ; set ; }
21
+
22
+ [ JsonProperty ( PropertyName = "pre" ) ]
23
+ int ? Pre { get ; set ; }
24
+
25
+ [ JsonProperty ( PropertyName = "post" ) ]
26
+ int ? Post { get ; set ; }
27
+
28
+ [ JsonProperty ( PropertyName = "dist" ) ]
29
+ int ? Dist { get ; set ; }
21
30
22
31
}
23
32
@@ -31,22 +40,30 @@ protected override void WrapInContainer(IQueryContainer container)
31
40
bool IQuery . IsConditionless { get { return false ; } }
32
41
public ISpanQuery Include { get ; set ; }
33
42
public ISpanQuery Exclude { get ; set ; }
34
- public double ? Boost { get ; set ; }
43
+ public double ? Boost { get ; set ; }
44
+ public int ? Pre { get ; set ; }
45
+ public int ? Post { get ; set ; }
46
+ public int ? Dist { get ; set ; }
35
47
}
36
48
37
49
public class SpanNotQuery < T > : ISpanNotQuery where T : class
38
50
{
51
+ private ISpanNotQuery Self { get { return this ; } }
52
+
39
53
ISpanQuery ISpanNotQuery . Include { get ; set ; }
40
54
41
55
ISpanQuery ISpanNotQuery . Exclude { get ; set ; }
42
- double ? ISpanNotQuery . Boost { get ; set ; }
56
+ double ? ISpanNotQuery . Boost { get ; set ; }
57
+ int ? ISpanNotQuery . Pre { get ; set ; }
58
+ int ? ISpanNotQuery . Post { get ; set ; }
59
+ int ? ISpanNotQuery . Dist { get ; set ; }
43
60
44
- bool IQuery . IsConditionless
61
+ bool IQuery . IsConditionless
45
62
{
46
63
get
47
64
{
48
- var excludeQuery = ( ( ISpanNotQuery ) this ) . Exclude as IQuery ;
49
- var includeQuery = ( ( ISpanNotQuery ) this ) . Include as IQuery ;
65
+ var excludeQuery = Self . Exclude as IQuery ;
66
+ var includeQuery = Self . Include as IQuery ;
50
67
51
68
return excludeQuery == null && includeQuery == null
52
69
|| ( includeQuery == null && excludeQuery . IsConditionless )
@@ -59,29 +76,43 @@ bool IQuery.IsConditionless
59
76
60
77
public SpanNotQuery < T > Include ( Func < SpanQuery < T > , SpanQuery < T > > selector )
61
78
{
62
- if ( selector == null )
63
- return this ;
64
- var descriptors = new List < SpanQuery < T > > ( ) ;
79
+ if ( selector == null ) return this ;
65
80
var span = new SpanQuery < T > ( ) ;
66
- var q = selector ( span ) ;
67
- ( ( ISpanNotQuery ) this ) . Include = q ;
81
+ Self . Include = selector ( span ) ; ;
68
82
return this ;
69
83
}
84
+
70
85
public SpanNotQuery < T > Exclude ( Func < SpanQuery < T > , SpanQuery < T > > selector )
71
86
{
72
- if ( selector == null )
73
- return this ;
74
- var descriptors = new List < SpanQuery < T > > ( ) ;
87
+ if ( selector == null ) return this ;
75
88
var span = new SpanQuery < T > ( ) ;
76
- var q = selector ( span ) ;
77
- ( ( ISpanNotQuery ) this ) . Exclude = q ;
89
+ Self . Exclude = selector ( span ) ; ;
90
+ return this ;
91
+ }
92
+
93
+ public SpanNotQuery < T > Boost ( double boost )
94
+ {
95
+ Self . Boost = boost ;
96
+ return this ;
97
+ }
98
+
99
+ public SpanNotQuery < T > Pre ( int pre )
100
+ {
101
+ Self . Pre = pre ;
102
+ return this ;
103
+ }
104
+
105
+ public SpanNotQuery < T > Post ( int post )
106
+ {
107
+ Self . Post = post ;
108
+ return this ;
109
+ }
110
+
111
+ public SpanNotQuery < T > Dist ( int dist )
112
+ {
113
+ Self . Dist = dist ;
78
114
return this ;
79
115
}
80
116
81
- public ISpanNotQuery Boost ( double boost )
82
- {
83
- ( ( ISpanNotQuery ) this ) . Boost = boost ;
84
- return this ;
85
- }
86
117
}
87
118
}
0 commit comments