15
15
*/
16
16
package org .springframework .data .elasticsearch .client .elc ;
17
17
18
+ import co .elastic .clients .elasticsearch .core .search .HitsMetadata ;
19
+ import co .elastic .clients .elasticsearch .core .search .Suggestion ;
20
+ import co .elastic .clients .elasticsearch .core .search .TotalHitsRelation ;
21
+ import co .elastic .clients .json .jackson .JacksonJsonpMapper ;
22
+
18
23
import java .util .ArrayList ;
19
24
import java .util .List ;
20
25
26
31
import com .google .common .collect .ImmutableList ;
27
32
import com .google .common .collect .ImmutableMap ;
28
33
29
- import co .elastic .clients .elasticsearch .core .search .HitsMetadata ;
30
- import co .elastic .clients .elasticsearch .core .search .Suggestion ;
31
- import co .elastic .clients .elasticsearch .core .search .TotalHitsRelation ;
32
- import co .elastic .clients .json .jackson .JacksonJsonpMapper ;
33
-
34
34
/**
35
35
* Tests for the factory class to create {@link SearchDocumentResponse} instances.
36
36
*
@@ -41,39 +41,40 @@ class SearchDocumentResponseBuilderUnitTests {
41
41
42
42
private JacksonJsonpMapper jsonpMapper = new JacksonJsonpMapper ();
43
43
44
- @ Test // GH- 2681
44
+ @ Test // # 2681
45
45
void shouldGetPhraseSuggestion () throws JSONException {
46
46
// arrange
47
47
final var hitsMetadata = new HitsMetadata .Builder <EntityAsMap >()
48
48
.total (total -> total
49
- .value (0 )
50
- .relation (TotalHitsRelation .Eq ))
49
+ .value (0 )
50
+ .relation (TotalHitsRelation .Eq ))
51
51
.hits (new ArrayList <>())
52
52
.build ();
53
53
54
54
final var suggestionTest = new Suggestion .Builder <EntityAsMap >()
55
- .phrase (phrase -> phrase
56
- .text ("National" )
57
- .offset (0 )
58
- .length (8 )
59
- .options (option -> option
60
- .text ("nations" )
61
- .highlighted ("highlighted-nations" )
62
- .score (0.11480146 )
63
- .collateMatch (false ))
64
- .options (option -> option
65
- .text ("national" )
66
- .highlighted ("highlighted-national" )
67
- .score ( 0.08063514 )
68
- .collateMatch (false )))
69
- .build ();
70
-
71
- final var sortProperties = ImmutableMap .<String , List <Suggestion <EntityAsMap >>>builder ()
72
- .put ("suggestionTest" , ImmutableList .of (suggestionTest ))
73
- .build ();
55
+ .phrase (phrase -> phrase
56
+ .text ("National" )
57
+ .offset (0 )
58
+ .length (8 )
59
+ .options (option -> option
60
+ .text ("nations" )
61
+ .highlighted ("highlighted-nations" )
62
+ .score (0.11480146 )
63
+ .collateMatch (false ))
64
+ .options (option -> option
65
+ .text ("national" )
66
+ .highlighted ("highlighted-national" )
67
+ .score (0.08063514 )
68
+ .collateMatch (false )))
69
+ .build ();
70
+
71
+ final var sortProperties = ImmutableMap .<String , List <Suggestion <EntityAsMap >>> builder ()
72
+ .put ("suggestionTest" , ImmutableList .of (suggestionTest ))
73
+ .build ();
74
74
75
75
// act
76
- final var actual = SearchDocumentResponseBuilder .from (hitsMetadata , null , null , null , sortProperties , null , jsonpMapper );
76
+ final var actual = SearchDocumentResponseBuilder .from (hitsMetadata , null , null , null , sortProperties , null ,
77
+ jsonpMapper );
77
78
78
79
// assert
79
80
SoftAssertions softly = new SoftAssertions ();
0 commit comments