@@ -18,6 +18,15 @@ public interface IMatchPhrasePrefixQuery : IFieldNameQuery
18
18
19
19
[ JsonProperty ( "slop" ) ]
20
20
int ? Slop { get ; set ; }
21
+
22
+ /// <summary>
23
+ /// If the analyzer used removes all tokens in a query like a stop filter does, the default behavior is
24
+ /// to match no documents at all. In order to change that, <see cref="ZeroTermsQuery"/> can be used,
25
+ /// which accepts <see cref="ZeroTermsQuery.None"/> (default) and <see cref="ZeroTermsQuery.All"/>
26
+ /// which corresponds to a match_all query.
27
+ /// </summary>
28
+ [ JsonProperty ( "zero_terms_query" ) ]
29
+ ZeroTermsQuery ? ZeroTermsQuery { get ; set ; }
21
30
}
22
31
23
32
public class MatchPhrasePrefixQuery : FieldNameQueryBase , IMatchPhrasePrefixQuery
@@ -28,6 +37,8 @@ public class MatchPhrasePrefixQuery : FieldNameQueryBase, IMatchPhrasePrefixQuer
28
37
public int ? MaxExpansions { get ; set ; }
29
38
public string Query { get ; set ; }
30
39
public int ? Slop { get ; set ; }
40
+ /// <inheritdoc />
41
+ public ZeroTermsQuery ? ZeroTermsQuery { get ; set ; }
31
42
32
43
internal override void InternalWrapInContainer ( IQueryContainer c ) => c . MatchPhrasePrefix = this ;
33
44
@@ -44,6 +55,7 @@ public class MatchPhrasePrefixQueryDescriptor<T>
44
55
string IMatchPhrasePrefixQuery . Analyzer { get ; set ; }
45
56
int ? IMatchPhrasePrefixQuery . MaxExpansions { get ; set ; }
46
57
int ? IMatchPhrasePrefixQuery . Slop { get ; set ; }
58
+ ZeroTermsQuery ? IMatchPhrasePrefixQuery . ZeroTermsQuery { get ; set ; }
47
59
48
60
public MatchPhrasePrefixQueryDescriptor < T > Query ( string query ) => Assign ( a => a . Query = query ) ;
49
61
@@ -52,5 +64,9 @@ public class MatchPhrasePrefixQueryDescriptor<T>
52
64
public MatchPhrasePrefixQueryDescriptor < T > MaxExpansions ( int ? maxExpansions ) => Assign ( a => a . MaxExpansions = maxExpansions ) ;
53
65
54
66
public MatchPhrasePrefixQueryDescriptor < T > Slop ( int ? slop ) => Assign ( a => a . Slop = slop ) ;
67
+
68
+ /// <inheritdoc cref="IMatchQuery.ZeroTermsQuery" />
69
+ public MatchPhrasePrefixQueryDescriptor < T > ZeroTermsQuery ( ZeroTermsQuery ? zeroTermsQuery ) => Assign ( a => a . ZeroTermsQuery = zeroTermsQuery ) ;
70
+
55
71
}
56
72
}
0 commit comments