File tree Expand file tree Collapse file tree 7 files changed +421
-248
lines changed
clients/algoliasearch-client-java-2/algoliasearch-core/src/main/java/com/algolia/utils
playground/java/src/main/java/com/algolia/playground
specs/search/paths/synonyms Expand file tree Collapse file tree 7 files changed +421
-248
lines changed Original file line number Diff line number Diff line change
1
+ package com .algolia .utils ;
2
+
3
+ import java .util .Iterator ;
4
+ import java .util .function .BooleanSupplier ;
5
+ import java .util .function .Supplier ;
6
+
7
+ public class AlgoliaIterableHelper {
8
+
9
+ public static <T > Iterable <T > createIterable (Supplier <Iterator <T >> executeQuery , BooleanSupplier _hasNext ) {
10
+ return new Iterable <T >() {
11
+ @ Override
12
+ public Iterator <T > iterator () {
13
+ return new Iterator <T >() {
14
+ private boolean isFirstRequest = true ;
15
+ private Iterator <T > currentIterator = null ;
16
+
17
+ @ Override
18
+ public boolean hasNext () {
19
+ if (isFirstRequest || (_hasNext .getAsBoolean () && !currentIterator .hasNext ())) {
20
+ currentIterator = executeQuery .get ();
21
+ isFirstRequest = false ;
22
+ }
23
+ return currentIterator != null && currentIterator .hasNext ();
24
+ }
25
+
26
+ @ Override
27
+ public T next () {
28
+ if (currentIterator == null || !currentIterator .hasNext ()) {
29
+ currentIterator = executeQuery .get ();
30
+ isFirstRequest = false ;
31
+ }
32
+ return currentIterator .next ();
33
+ }
34
+ };
35
+ }
36
+ };
37
+ }
38
+ }
Original file line number Diff line number Diff line change
1
+ package com .algolia .utils ;
2
+
3
+ public class Holder <T > {
4
+
5
+ public T value ;
6
+
7
+ public Holder () {
8
+ this .value = null ;
9
+ }
10
+
11
+ public Holder (T value ) {
12
+ this .value = value ;
13
+ }
14
+ }
Original file line number Diff line number Diff line change @@ -64,6 +64,7 @@ public static void main(String[] args) {
64
64
SearchResponses <Actor > sr = result .get ();
65
65
Actor a = sr .getResults ().get (0 ).getHits ().get (0 );
66
66
System .out .println (a .name );
67
+
67
68
} catch (InterruptedException e ) {
68
69
System .err .println ("InterrupedException" + e .getMessage ());
69
70
e .printStackTrace ();
Original file line number Diff line number Diff line change @@ -39,17 +39,6 @@ synonymHit:
39
39
items :
40
40
type : string
41
41
description : List of query words that will match the token.
42
- _highlightResult :
43
- type : object
44
- description : Highlighted results.
45
- additionalProperties : false
46
- properties :
47
- type :
48
- $ref : ' ../../../common/schemas/Hit.yml#/highlightResultMap'
49
- synonyms :
50
- type : array
51
- items :
52
- $ref : ' ../../../common/schemas/Hit.yml#/highlightResultMap'
53
42
required :
54
43
- objectID
55
44
- type
Original file line number Diff line number Diff line change 8
8
description : Search or browse all synonyms, optionally filtering them by type.
9
9
parameters :
10
10
- $ref : ' ../../../common/parameters.yml#/IndexName'
11
- - $ref : ' common/parameters.yml#/Type'
11
+ - $ref : ' ./ common/parameters.yml#/Type'
12
12
- $ref : ' ../../../common/parameters.yml#/PageDefault0'
13
13
- $ref : ' ../../../common/parameters.yml#/HitsPerPage'
14
14
requestBody :
28
28
content :
29
29
application/json :
30
30
schema :
31
- $ref : ' common/schemas.yml#/searchSynonymsResponse'
31
+ $ref : ' ./ common/schemas.yml#/searchSynonymsResponse'
32
32
' 400 ' :
33
33
$ref : ' ../../../common/responses/BadRequest.yml'
34
34
' 402 ' :
Load Diff Large diffs are not rendered by default.
You can’t perform that action at this time.
0 commit comments