File tree 4 files changed +50
-3
lines changed
Nest.Tests.Integration/Search
4 files changed +50
-3
lines changed Original file line number Diff line number Diff line change @@ -143,6 +143,29 @@ public void TestPartialFields()
143
143
Assert . True ( results . Hits . Hits . All ( h => h . PartialFields [ "partial1" ] . Origin . lon != 0 && h . PartialFields [ "partial1" ] . Origin . lat == 0 ) ) ;
144
144
}
145
145
146
+ [ Test ]
147
+ public void TermSuggest ( )
148
+ {
149
+ var results = this . _client . Search < ElasticSearchProject > ( s => s
150
+ . Query ( q => q . MatchAll ( ) )
151
+ . TermSuggest ( "mySuggest" , m => m . SuggestMode ( SuggestMode . Always ) . Text ( "Sanskrti" ) . Size ( 1 ) . OnField ( "country" ) )
152
+ ) ;
153
+
154
+ Assert . NotNull ( results ) ;
155
+ Assert . True ( results . IsValid ) ;
156
+
157
+ Assert . NotNull ( results . Suggest ) ;
158
+ Assert . NotNull ( results . Suggest . Values ) ;
159
+
160
+ Assert . AreEqual ( results . Suggest . Values . Count , 1 ) ;
161
+ Assert . AreEqual ( results . Suggest . Values . First ( ) . Count ( ) , 1 ) ;
162
+
163
+ Assert . NotNull ( results . Suggest . Values . First ( ) . First ( ) . Options ) ;
164
+ Assert . GreaterOrEqual ( results . Suggest . Values . First ( ) . First ( ) . Options . Count ( ) , 1 ) ;
165
+
166
+ Assert . AreEqual ( results . Suggest . Values . First ( ) . First ( ) . Options . First ( ) . Text , "Sanskrit" ) ;
167
+ }
168
+
146
169
[ Test ]
147
170
public void TestCustomFiltersScore ( )
148
171
{
Original file line number Diff line number Diff line change 215
215
<Compile Include =" Search\SearchType\ScriptFieldTests.cs" />
216
216
<Compile Include =" Internals\Serialize\SerializeTests.cs" />
217
217
<Compile Include =" Search\Sort\SortTests.cs" />
218
+ <Compile Include =" Search\Suggest\TermSuggestTests.cs" />
218
219
<Compile Include =" Settings\UsePrettyResponseTests.cs" />
219
220
<Compile Include =" Test.Designer.cs" >
220
221
<DependentUpon >Test.settings</DependentUpon >
Original file line number Diff line number Diff line change
1
+ using NUnit . Framework ;
2
+ using Nest . Tests . MockData . Domain ;
3
+
4
+ namespace Nest . Tests . Unit . Search . Query . Bool
5
+ {
6
+ [ TestFixture ]
7
+ public class TermSuggestTests : BaseJsonTests
8
+ {
9
+ [ Test ]
10
+ public void TermSuggestDescriptorTest ( )
11
+ {
12
+ var termSuggestDescriptor = new TermSuggestDescriptor < ElasticSearchProject > ( ) . MaxEdits ( 3 ) . MaxInspections ( 17 ) . OnField ( "field1" ) ;
13
+ var json = TestElasticClient . Serialize ( termSuggestDescriptor ) ;
14
+
15
+ var expected = @"{
16
+ ""max_edits"": 3,
17
+ ""max_inspections"": 17,
18
+ ""field"": ""field1""
19
+ }" ;
20
+
21
+ Assert . True ( json . JsonEquals ( expected ) , json ) ;
22
+ }
23
+
24
+
25
+ }
26
+ }
Original file line number Diff line number Diff line change @@ -136,9 +136,6 @@ Global
136
136
{B9FE4875-0171-40F7-A357-064A93BE09C6} = {DDC38E1C-13BF-4C96-A3BF-60F14DFC5069}
137
137
{2727A374-9866-4A9D-9A40-6175334B5992} = {DDC38E1C-13BF-4C96-A3BF-60F14DFC5069}
138
138
EndGlobalSection
139
- GlobalSection (Performance ) = preSolution
140
- HasPerformanceSessions = true
141
- EndGlobalSection
142
139
GlobalSection (MonoDevelopProperties ) = preSolution
143
140
StartupItem = ElasticSearch .ConsolePlayground \ElasticSearch .ConsolePlayground .csproj
144
141
EndGlobalSection
You can’t perform that action at this time.
0 commit comments