8
8
9
9
namespace Nest . Tests . Unit . Search . Suggest
10
10
{
11
- [ TestFixture ]
12
- public class CompletionSuggestTests : BaseJsonTests
13
- {
14
- [ Test ]
15
- public void CompletionSuggestDescriptorTest ( )
16
- {
17
- var completionSuggestDescriptor = new CompletionSuggestDescriptor < ElasticsearchProject > ( )
18
- . OnField ( "suggest" )
19
- . Text ( "n" ) ;
20
-
21
- var json = TestElasticClient . Serialize ( completionSuggestDescriptor ) ;
22
-
23
- var expected = @"{ "" field"" : ""suggest"" }" ;
24
-
25
- Assert . IsTrue ( json . JsonEquals ( expected ) , json ) ;
26
- }
27
-
28
- [ Test ]
29
- public void CompletionSuggestDescriptorDefaultFuzzyTest ( )
30
- {
31
- var completionSuggestDescriptor = new CompletionSuggestDescriptor < ElasticsearchProject > ( )
32
- . OnField ( "suggest" )
33
- . Text ( "n" )
11
+ [ TestFixture ]
12
+ public class CompletionSuggestTests : BaseJsonTests
13
+ {
14
+ [ Test ]
15
+ public void CompletionSuggestDescriptorTest ( )
16
+ {
17
+ var completionSuggestDescriptor = new CompletionSuggestDescriptor < ElasticsearchProject > ( )
18
+ . OnField ( "suggest" )
19
+ . Text ( "n" ) ;
20
+
21
+ var json = TestElasticClient . Serialize ( completionSuggestDescriptor ) ;
22
+
23
+ var expected = @"{ field: ""suggest"" }" ;
24
+
25
+ Assert . IsTrue ( json . JsonEquals ( expected ) , json ) ;
26
+ }
27
+
28
+ [ Test ]
29
+ public void CompletionSuggestDescriptorDefaultFuzzyTest ( )
30
+ {
31
+ var completionSuggestDescriptor = new CompletionSuggestDescriptor < ElasticsearchProject > ( )
32
+ . OnField ( "suggest" )
33
+ . Text ( "n" )
34
34
. Fuzzy ( ) ;
35
35
36
- var json = TestElasticClient . Serialize ( completionSuggestDescriptor ) ;
36
+ var json = TestElasticClient . Serialize ( completionSuggestDescriptor ) ;
37
37
38
- var expected = @"{
39
- "" fuzzy"" : {
40
- "" edit_distance"" : 1,
41
- "" transpositions"" : true,
42
- "" min_length"" : 3,
43
- "" prefix_length"" : 1
38
+ var expected = @"{
39
+ fuzzy: {
40
+ edit_distance: 1,
41
+ transpositions: true,
42
+ min_length: 3,
43
+ prefix_length: 1
44
44
},
45
- "" field"" : ""suggest""
45
+ field: ""suggest""
46
46
}" ;
47
47
48
- Assert . IsTrue ( json . JsonEquals ( expected ) , json ) ;
49
- }
48
+ Assert . IsTrue ( json . JsonEquals ( expected ) , json ) ;
49
+ }
50
50
51
51
[ Test ]
52
52
public void CompletionSuggestDescriptorDefaultFuzzinessTest ( )
@@ -59,40 +59,41 @@ public void CompletionSuggestDescriptorDefaultFuzzinessTest()
59
59
var json = TestElasticClient . Serialize ( completionSuggestDescriptor ) ;
60
60
61
61
var expected = @"{
62
- ""fuzzy"": {
62
+ fuzzy: {
63
+ fuzziness: {}
63
64
},
64
- "" field"" : ""suggest""
65
+ field: ""suggest""
65
66
}" ;
66
67
67
68
Assert . IsTrue ( json . JsonEquals ( expected ) , json ) ;
68
69
}
69
70
70
- [ Test ]
71
- public void CompletionSuggestDescriptorFuzzyTest ( )
72
- {
73
- var completionSuggestDescriptor = new CompletionSuggestDescriptor < ElasticsearchProject > ( )
74
- . OnField ( "suggest" )
75
- . Text ( "n" )
76
- . Fuzzy ( f => f
77
- . EditDistance ( 2 )
78
- . Transpositions ( false )
79
- . MinLength ( 5 )
80
- . PrefixLength ( 4 ) ) ;
81
-
82
- var json = TestElasticClient . Serialize ( completionSuggestDescriptor ) ;
83
-
84
- var expected = @"{
85
- "" fuzzy"": {
86
- "" edit_distance"" : 2,
87
- "" transpositions"" : false,
88
- "" min_length"" : 5,
89
- "" prefix_length"" : 4
71
+ [ Test ]
72
+ public void CompletionSuggestDescriptorFuzzyTest ( )
73
+ {
74
+ var completionSuggestDescriptor = new CompletionSuggestDescriptor < ElasticsearchProject > ( )
75
+ . OnField ( "suggest" )
76
+ . Text ( "n" )
77
+ . Fuzzy ( f => f
78
+ . EditDistance ( 2 )
79
+ . Transpositions ( false )
80
+ . MinLength ( 5 )
81
+ . PrefixLength ( 4 ) ) ;
82
+
83
+ var json = TestElasticClient . Serialize ( completionSuggestDescriptor ) ;
84
+
85
+ var expected = @"{
86
+ fuzzy"": {
87
+ edit_distance: 2,
88
+ transpositions: false,
89
+ min_length: 5,
90
+ prefix_length: 4
90
91
},
91
- "" field"" : ""suggest""
92
+ field: ""suggest""
92
93
}" ;
93
94
94
- Assert . IsTrue ( json . JsonEquals ( expected ) , json ) ;
95
- }
95
+ Assert . IsTrue ( json . JsonEquals ( expected ) , json ) ;
96
+ }
96
97
97
98
[ Test ]
98
99
public void CompletionSuggestDescriptorFuzzinessTest ( )
@@ -105,10 +106,10 @@ public void CompletionSuggestDescriptorFuzzinessTest()
105
106
var json = TestElasticClient . Serialize ( completionSuggestDescriptor ) ;
106
107
107
108
var expected = @"{
108
- "" fuzzy"" : {
109
- "" fuzziness"" : 1
109
+ fuzzy: {
110
+ fuzziness: 1
110
111
},
111
- "" field"" : ""suggest""
112
+ field: ""suggest""
112
113
}" ;
113
114
114
115
Assert . IsTrue ( json . JsonEquals ( expected ) , json ) ;
@@ -125,10 +126,10 @@ public void CompletionSuggestDescriptorFuzzinessDoubleTest()
125
126
var json = TestElasticClient . Serialize ( completionSuggestDescriptor ) ;
126
127
127
128
var expected = @"{
128
- "" fuzzy"" : {
129
- "" fuzziness"" : 0.4
129
+ fuzzy: {
130
+ fuzziness: 0.4
130
131
},
131
- "" field"" : ""suggest""
132
+ field: ""suggest""
132
133
}" ;
133
134
134
135
Assert . IsTrue ( json . JsonEquals ( expected ) , json ) ;
@@ -140,7 +141,7 @@ public void CompletionSuggestOnSearchTest()
140
141
var search = this . _client . Search < ElasticsearchProject > ( s => s
141
142
. SuggestCompletion ( "mycompletionsuggest" , ts => ts
142
143
. Text ( "n" )
143
- . OnField ( p=> p . Name )
144
+ . OnField ( p => p . Name )
144
145
. Fuzzy ( )
145
146
)
146
147
) ;
@@ -182,6 +183,7 @@ public void CompletionSuggestWithFuzzinessOnSearchTest()
182
183
text: ""n"",
183
184
completion: {
184
185
fuzzy: {
186
+ fuzziness: {}
185
187
},
186
188
field: ""name""
187
189
}
@@ -191,5 +193,5 @@ public void CompletionSuggestWithFuzzinessOnSearchTest()
191
193
var json = search . ConnectionStatus . Request . Utf8String ( ) ;
192
194
Assert . True ( json . JsonEquals ( expected ) , json ) ;
193
195
}
194
- }
196
+ }
195
197
}
0 commit comments