1
- /* Copyright 2016 -present MongoDB Inc.
1
+ /* Copyright 2010 -present MongoDB Inc.
2
2
*
3
3
* Licensed under the Apache License, Version 2.0 (the "License");
4
4
* you may not use this file except in compliance with the License.
19
19
namespace MongoDB . Driver . Search
20
20
{
21
21
/// <summary>
22
- /// Fluent interface for compound search definitions.
22
+ /// A builder for compound search definitions.
23
23
/// </summary>
24
24
/// <typeparam name="TDocument">The type of the document.</typeparam>
25
- public sealed class CompoundSearchDefinitionFluent < TDocument >
25
+ public sealed class CompoundSearchDefinitionBuilder < TDocument >
26
26
{
27
27
private List < SearchDefinition < TDocument > > _must ;
28
28
private List < SearchDefinition < TDocument > > _mustNot ;
@@ -34,101 +34,101 @@ public sealed class CompoundSearchDefinitionFluent<TDocument>
34
34
/// Adds clauses which must match to produce results.
35
35
/// </summary>
36
36
/// <param name="clauses">The clauses.</param>
37
- /// <returns>The compound fluent interface .</returns>
38
- public CompoundSearchDefinitionFluent < TDocument > Must ( IEnumerable < SearchDefinition < TDocument > > clauses ) =>
37
+ /// <returns>The compound search definition builder .</returns>
38
+ public CompoundSearchDefinitionBuilder < TDocument > Must ( IEnumerable < SearchDefinition < TDocument > > clauses ) =>
39
39
AddClauses ( ref _must , clauses ) ;
40
40
41
41
/// <summary>
42
42
/// Adds clauses which must match to produce results.
43
43
/// </summary>
44
44
/// <param name="clauses">The clauses.</param>
45
- /// <returns>The compound fluent interface .</returns>
46
- public CompoundSearchDefinitionFluent < TDocument > Must ( params SearchDefinition < TDocument > [ ] clauses ) =>
45
+ /// <returns>The compound search definition builder .</returns>
46
+ public CompoundSearchDefinitionBuilder < TDocument > Must ( params SearchDefinition < TDocument > [ ] clauses ) =>
47
47
Must ( ( IEnumerable < SearchDefinition < TDocument > > ) clauses ) ;
48
48
49
49
/// <summary>
50
50
/// Adds clauses which must not match for a document to be included in the
51
51
/// results.
52
52
/// </summary>
53
53
/// <param name="clauses">The clauses.</param>
54
- /// <returns>The compound fluent interface .</returns>
55
- public CompoundSearchDefinitionFluent < TDocument > MustNot ( IEnumerable < SearchDefinition < TDocument > > clauses ) =>
54
+ /// <returns>The compound search definition builder .</returns>
55
+ public CompoundSearchDefinitionBuilder < TDocument > MustNot ( IEnumerable < SearchDefinition < TDocument > > clauses ) =>
56
56
AddClauses ( ref _mustNot , clauses ) ;
57
57
58
58
/// <summary>
59
59
/// Adds clauses which must not match for a document to be included in the
60
60
/// results.
61
61
/// </summary>
62
62
/// <param name="clauses">The clauses.</param>
63
- /// <returns>The compound fluent interface .</returns>
64
- public CompoundSearchDefinitionFluent < TDocument > MustNot ( params SearchDefinition < TDocument > [ ] clauses ) =>
63
+ /// <returns>The compound search definition builder .</returns>
64
+ public CompoundSearchDefinitionBuilder < TDocument > MustNot ( params SearchDefinition < TDocument > [ ] clauses ) =>
65
65
MustNot ( ( IEnumerable < SearchDefinition < TDocument > > ) clauses ) ;
66
66
67
67
/// <summary>
68
68
/// Adds clauses which cause documents in the result set to be scored higher if
69
69
/// they match.
70
70
/// </summary>
71
71
/// <param name="clauses">The clauses.</param>
72
- /// <returns>The compound fluent interface .</returns>
73
- public CompoundSearchDefinitionFluent < TDocument > Should ( IEnumerable < SearchDefinition < TDocument > > clauses ) =>
72
+ /// <returns>The compound search definition builder .</returns>
73
+ public CompoundSearchDefinitionBuilder < TDocument > Should ( IEnumerable < SearchDefinition < TDocument > > clauses ) =>
74
74
AddClauses ( ref _should , clauses ) ;
75
75
76
76
/// <summary>
77
77
/// Adds clauses which cause documents in the result set to be scored higher if
78
78
/// they match.
79
79
/// </summary>
80
80
/// <param name="clauses">The clauses.</param>
81
- /// <returns>The compound fluent interface .</returns>
82
- public CompoundSearchDefinitionFluent < TDocument > Should ( params SearchDefinition < TDocument > [ ] clauses ) =>
81
+ /// <returns>The compound search definition builder .</returns>
82
+ public CompoundSearchDefinitionBuilder < TDocument > Should ( params SearchDefinition < TDocument > [ ] clauses ) =>
83
83
Should ( ( IEnumerable < SearchDefinition < TDocument > > ) clauses ) ;
84
84
85
85
/// <summary>
86
86
/// Adds clauses which must all match for a document to be included in the
87
87
/// results.
88
88
/// </summary>
89
89
/// <param name="clauses">The clauses.</param>
90
- /// <returns>The compound fluent interface .</returns>
91
- public CompoundSearchDefinitionFluent < TDocument > Filter ( IEnumerable < SearchDefinition < TDocument > > clauses ) =>
90
+ /// <returns>The compound search definition builder .</returns>
91
+ public CompoundSearchDefinitionBuilder < TDocument > Filter ( IEnumerable < SearchDefinition < TDocument > > clauses ) =>
92
92
AddClauses ( ref _filter , clauses ) ;
93
93
94
94
/// <summary>
95
95
/// Adds clauses which must all match for a document to be included in the
96
96
/// results.
97
97
/// </summary>
98
98
/// <param name="clauses">The clauses.</param>
99
- /// <returns>The compound fluent interface .</returns>
100
- public CompoundSearchDefinitionFluent < TDocument > Filter ( params SearchDefinition < TDocument > [ ] clauses ) =>
99
+ /// <returns>The compound search definition builder .</returns>
100
+ public CompoundSearchDefinitionBuilder < TDocument > Filter ( params SearchDefinition < TDocument > [ ] clauses ) =>
101
101
Filter ( ( IEnumerable < SearchDefinition < TDocument > > ) clauses ) ;
102
102
103
103
/// <summary>
104
104
/// Sets a value specifying the minimum number of should clauses the must match
105
105
/// to include a document in the results.
106
106
/// </summary>
107
107
/// <param name="minimumShouldMatch">The value to set.</param>
108
- /// <returns>The compound fluent interface .</returns>
109
- public CompoundSearchDefinitionFluent < TDocument > MinimumShouldMatch ( int minimumShouldMatch )
108
+ /// <returns>The compound search definition builder .</returns>
109
+ public CompoundSearchDefinitionBuilder < TDocument > MinimumShouldMatch ( int minimumShouldMatch )
110
110
{
111
111
_minimumShouldMatch = minimumShouldMatch ;
112
112
return this ;
113
113
}
114
114
115
115
/// <summary>
116
- /// Constructs a search definition from the fluent interface .
116
+ /// Constructs a search definition from the builder .
117
117
/// </summary>
118
118
/// <returns>A compound search definition.</returns>
119
119
public SearchDefinition < TDocument > ToSearchDefinition ( ) =>
120
120
new CompoundSearchDefinition < TDocument > ( _must , _mustNot , _should , _filter , _minimumShouldMatch ) ;
121
121
122
122
/// <summary>
123
- /// Performs an implicit conversion from a <see cref="CompoundSearchDefinitionFluent {TDocument}"/>
123
+ /// Performs an implicit conversion from a <see cref="CompoundSearchDefinitionBuilder {TDocument}"/>
124
124
/// to a <see cref="SearchDefinition{TDocument}"/>.
125
125
/// </summary>
126
- /// <param name="compound ">The compound fluent interface .</param>
126
+ /// <param name="builder ">The compound search definition builder .</param>
127
127
/// <returns>The result of the conversion.</returns>
128
- public static implicit operator SearchDefinition < TDocument > ( CompoundSearchDefinitionFluent < TDocument > compound ) =>
129
- compound . ToSearchDefinition ( ) ;
128
+ public static implicit operator SearchDefinition < TDocument > ( CompoundSearchDefinitionBuilder < TDocument > builder ) =>
129
+ builder . ToSearchDefinition ( ) ;
130
130
131
- private CompoundSearchDefinitionFluent < TDocument > AddClauses ( ref List < SearchDefinition < TDocument > > clauses , IEnumerable < SearchDefinition < TDocument > > newClauses )
131
+ private CompoundSearchDefinitionBuilder < TDocument > AddClauses ( ref List < SearchDefinition < TDocument > > clauses , IEnumerable < SearchDefinition < TDocument > > newClauses )
132
132
{
133
133
Ensure . IsNotNull ( newClauses , nameof ( newClauses ) ) ;
134
134
( clauses ??= new ( ) ) . AddRange ( newClauses ) ;
0 commit comments