Skip to content

Commit 3a22fb4

Browse files
committed
Merge branch 'fix/geodistance'
2 parents a5b85d7 + 18beb19 commit 3a22fb4

File tree

5 files changed

+99
-53
lines changed

5 files changed

+99
-53
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
# 1.2.2
2+
3+
- Fixed a bug for geoDistance when we receive a MAX_ULONG value of 18446744073709551615 from the server #156
4+
15
# 1.2.1
26

37
- Fixed a bug when using advanced search: Disjunctive filters where flattened and lost proper AND / OR operator from the group #151

Gemfile.lock

Lines changed: 62 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -1,101 +1,114 @@
11
GEM
22
remote: https://rubygems.org/
33
specs:
4-
CFPropertyList (3.0.0)
5-
addressable (2.5.2)
6-
public_suffix (>= 2.0.2, < 4.0)
4+
CFPropertyList (3.0.2)
5+
addressable (2.7.0)
6+
public_suffix (>= 2.0.2, < 5.0)
77
atomos (0.1.3)
8-
babosa (1.0.2)
9-
claide (1.0.2)
8+
babosa (1.0.3)
9+
claide (1.0.3)
1010
colored (1.2)
1111
colored2 (3.1.2)
1212
commander-fastlane (4.4.6)
1313
highline (~> 1.7.2)
1414
declarative (0.0.10)
1515
declarative-option (0.1.0)
16-
domain_name (0.5.20180417)
16+
digest-crc (0.4.1)
17+
domain_name (0.5.20190701)
1718
unf (>= 0.0.5, < 1.0.0)
18-
dotenv (2.5.0)
19-
emoji_regex (0.1.1)
20-
excon (0.62.0)
21-
faraday (0.15.4)
19+
dotenv (2.7.5)
20+
emoji_regex (1.0.1)
21+
excon (0.72.0)
22+
faraday (0.17.3)
2223
multipart-post (>= 1.2, < 3)
2324
faraday-cookie_jar (0.0.6)
2425
faraday (>= 0.7.4)
2526
http-cookie (~> 1.0.0)
26-
faraday_middleware (0.12.2)
27+
faraday_middleware (0.13.1)
2728
faraday (>= 0.7.4, < 1.0)
28-
fastimage (2.1.5)
29-
fastlane (2.109.0)
29+
fastimage (2.1.7)
30+
fastlane (2.141.0)
3031
CFPropertyList (>= 2.3, < 4.0.0)
3132
addressable (>= 2.3, < 3.0.0)
3233
babosa (>= 1.0.2, < 2.0.0)
33-
bundler (>= 1.12.0, < 2.0.0)
34+
bundler (>= 1.12.0, < 3.0.0)
3435
colored
3536
commander-fastlane (>= 4.4.6, < 5.0.0)
3637
dotenv (>= 2.1.1, < 3.0.0)
37-
emoji_regex (~> 0.1)
38-
excon (>= 0.45.0, < 1.0.0)
39-
faraday (~> 0.9)
38+
emoji_regex (>= 0.1, < 2.0)
39+
excon (>= 0.71.0, < 1.0.0)
40+
faraday (~> 0.17)
4041
faraday-cookie_jar (~> 0.0.6)
41-
faraday_middleware (~> 0.9)
42+
faraday_middleware (~> 0.13.1)
4243
fastimage (>= 2.1.0, < 3.0.0)
4344
gh_inspector (>= 1.1.2, < 2.0.0)
44-
google-api-client (>= 0.21.2, < 0.24.0)
45+
google-api-client (>= 0.29.2, < 0.37.0)
46+
google-cloud-storage (>= 1.15.0, < 2.0.0)
4547
highline (>= 1.7.2, < 2.0.0)
4648
json (< 3.0.0)
47-
mini_magick (~> 4.5.1)
48-
multi_json
49+
jwt (~> 2.1.0)
50+
mini_magick (>= 4.9.4, < 5.0.0)
4951
multi_xml (~> 0.5)
5052
multipart-post (~> 2.0.0)
5153
plist (>= 3.1.0, < 4.0.0)
5254
public_suffix (~> 2.0.0)
53-
rubyzip (>= 1.2.2, < 2.0.0)
55+
rubyzip (>= 1.3.0, < 2.0.0)
5456
security (= 0.1.3)
5557
simctl (~> 1.6.3)
5658
slack-notifier (>= 2.0.0, < 3.0.0)
57-
terminal-notifier (>= 1.6.2, < 2.0.0)
59+
terminal-notifier (>= 2.0.0, < 3.0.0)
5860
terminal-table (>= 1.4.5, < 2.0.0)
5961
tty-screen (>= 0.6.3, < 1.0.0)
6062
tty-spinner (>= 0.8.0, < 1.0.0)
6163
word_wrap (~> 1.0.0)
62-
xcodeproj (>= 1.6.0, < 2.0.0)
64+
xcodeproj (>= 1.13.0, < 2.0.0)
6365
xcpretty (~> 0.3.0)
6466
xcpretty-travis-formatter (>= 0.0.3)
6567
gh_inspector (1.1.3)
66-
google-api-client (0.23.9)
68+
google-api-client (0.36.4)
6769
addressable (~> 2.5, >= 2.5.1)
68-
googleauth (>= 0.5, < 0.7.0)
70+
googleauth (~> 0.9)
6971
httpclient (>= 2.8.1, < 3.0)
70-
mime-types (~> 3.0)
72+
mini_mime (~> 1.0)
7173
representable (~> 3.0)
7274
retriable (>= 2.0, < 4.0)
73-
signet (~> 0.9)
74-
googleauth (0.6.7)
75+
signet (~> 0.12)
76+
google-cloud-core (1.5.0)
77+
google-cloud-env (~> 1.0)
78+
google-cloud-errors (~> 1.0)
79+
google-cloud-env (1.3.0)
80+
faraday (~> 0.11)
81+
google-cloud-errors (1.0.0)
82+
google-cloud-storage (1.25.1)
83+
addressable (~> 2.5)
84+
digest-crc (~> 0.4)
85+
google-api-client (~> 0.33)
86+
google-cloud-core (~> 1.2)
87+
googleauth (~> 0.9)
88+
mini_mime (~> 1.0)
89+
googleauth (0.10.0)
7590
faraday (~> 0.12)
7691
jwt (>= 1.4, < 3.0)
7792
memoist (~> 0.16)
7893
multi_json (~> 1.11)
7994
os (>= 0.9, < 2.0)
80-
signet (~> 0.7)
95+
signet (~> 0.12)
8196
highline (1.7.10)
8297
http-cookie (1.0.3)
8398
domain_name (~> 0.5)
8499
httpclient (2.8.3)
85-
json (2.1.0)
100+
json (2.3.0)
86101
jwt (2.1.0)
87-
memoist (0.16.0)
88-
mime-types (3.2.2)
89-
mime-types-data (~> 3.2015)
90-
mime-types-data (3.2018.0812)
91-
mini_magick (4.5.1)
92-
multi_json (1.13.1)
102+
memoist (0.16.2)
103+
mini_magick (4.10.1)
104+
mini_mime (1.0.2)
105+
multi_json (1.14.1)
93106
multi_xml (0.6.0)
94107
multipart-post (2.0.0)
95108
nanaimo (0.2.6)
96109
naturally (2.2.0)
97-
os (1.0.0)
98-
plist (3.4.0)
110+
os (1.0.1)
111+
plist (3.5.0)
99112
public_suffix (2.0.5)
100113
representable (3.0.4)
101114
declarative (< 0.1.0)
@@ -105,29 +118,29 @@ GEM
105118
rouge (2.0.7)
106119
rubyzip (1.3.0)
107120
security (0.1.3)
108-
signet (0.11.0)
121+
signet (0.12.0)
109122
addressable (~> 2.3)
110123
faraday (~> 0.9)
111124
jwt (>= 1.5, < 3.0)
112125
multi_json (~> 1.10)
113-
simctl (1.6.5)
126+
simctl (1.6.8)
114127
CFPropertyList
115128
naturally
116129
slack-notifier (2.3.2)
117-
terminal-notifier (1.8.0)
130+
terminal-notifier (2.0.0)
118131
terminal-table (1.8.0)
119132
unicode-display_width (~> 1.1, >= 1.1.1)
120-
tty-cursor (0.6.0)
121-
tty-screen (0.6.5)
122-
tty-spinner (0.9.0)
123-
tty-cursor (~> 0.6.0)
133+
tty-cursor (0.7.1)
134+
tty-screen (0.7.1)
135+
tty-spinner (0.9.3)
136+
tty-cursor (~> 0.7)
124137
uber (0.1.0)
125138
unf (0.1.4)
126139
unf_ext
127-
unf_ext (0.0.7.5)
128-
unicode-display_width (1.4.0)
140+
unf_ext (0.0.7.6)
141+
unicode-display_width (1.6.1)
129142
word_wrap (1.0.0)
130-
xcodeproj (1.7.0)
143+
xcodeproj (1.15.0)
131144
CFPropertyList (>= 2.3.3, < 4.0)
132145
atomos (~> 0.1.3)
133146
claide (>= 1.0.2, < 2.0)

buildSrc/src/main/kotlin/Library.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@ object Library: Dependency {
22

33
override val group = "com.algolia"
44
override val artifact = "algoliasearch-client-kotlin"
5-
override val version = "1.2.1"
5+
override val version = "1.2.2"
66
}

src/commonMain/kotlin/com/algolia/search/model/search/RankingInfo.kt

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,7 @@ import com.algolia.search.endpoint.EndpointPlaces
44
import com.algolia.search.model.settings.RankingCriterion
55
import com.algolia.search.model.settings.Settings
66
import com.algolia.search.serialize.*
7-
import kotlinx.serialization.SerialName
8-
import kotlinx.serialization.Serializable
7+
import kotlinx.serialization.*
98

109

1110
@Serializable
@@ -39,7 +38,7 @@ public data class RankingInfo(
3938
* Distance between the geo location in the search query and the best matching geo location in the record,
4039
* divided by the geo precision (in meters).
4140
*/
42-
@SerialName(KeyGeoDistance) val geoDistance: Int,
41+
@SerialName(KeyGeoDistance) @Serializable(with=KSerializerGeoDistance::class) val geoDistance: GeoDistance,
4342
/**
4443
* Precision used when computing the geo distance, in meters.
4544
* All distances will be floored to a multiple of this precision.
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
package com.algolia.search.serialize
2+
3+
import kotlinx.serialization.Decoder
4+
import kotlinx.serialization.Encoder
5+
import kotlinx.serialization.KSerializer
6+
import kotlinx.serialization.Serializer
7+
import kotlinx.serialization.internal.SerialClassDescImpl
8+
9+
typealias GeoDistance = Int
10+
11+
@Serializer(forClass = GeoDistance::class)
12+
public object KSerializerGeoDistance: KSerializer<GeoDistance> {
13+
override val descriptor = SerialClassDescImpl("GeoDistance")
14+
15+
override fun serialize(encoder: Encoder, obj: GeoDistance) {
16+
try {
17+
encoder.encodeInt(obj)
18+
} catch (e: Exception) {
19+
encoder.encodeInt(-1)
20+
}
21+
}
22+
23+
override fun deserialize(decoder: Decoder): GeoDistance {
24+
return try {
25+
decoder.decodeInt()
26+
} catch (e: Exception) {
27+
-1
28+
}
29+
}
30+
}

0 commit comments

Comments
 (0)