Skip to content

Commit c3306ca

Browse files
chore(client): bump client to stable version (algolia#119)
1 parent cd31b34 commit c3306ca

File tree

4 files changed

+24
-12
lines changed

4 files changed

+24
-12
lines changed

helper/lib/src/model/search_state.dart

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -276,20 +276,23 @@ class SearchState implements MultiSearchState {
276276
/// The rectangle is defined by two diagonally opposite points (hereafter `p1` and `p2`),
277277
/// hence by 4 floats: `p1Lat`, `p1Lng`, `p2Lat`, `p2Lng`.
278278
///
279-
/// For example: `insideBoundingBox = [ 47.3165, 4.9665, 47.3424, 5.0201 ]`
279+
/// For example: `insideBoundingBox = [[47.3165, 4.9665, 47.3424, 5.0201]]`
280280
///
281281
/// **Usage notes**
282282
/// - You may specify multiple bounding boxes, in which case the search will use the
283-
/// union (OR) of the rectangles. To do this, pass either:
284-
/// - more than 4 values (must be a multiple of 4: 8, 12…); example:
285-
/// `47.3165,4.9665,47.3424,5.0201,40.9234,2.1185,38.6430,1.9916`;
283+
/// union (OR) of the rectangles. To do this, pass a list of lists of
284+
/// floats (each inner array must contain exactly 4 values); example:
285+
/// [
286+
/// [47.3165, 4.9665, 47.3424, 5.0201],
287+
/// [40.9234, 2.1185, 38.6430, 1.9916]
288+
/// ];
286289
/// - [aroundLatLng] and [aroundLatLngViaIP] will be ignored if used along with this
287290
/// parameter.
288291
/// - Be careful when your coordinates cross over the `180th meridian`.
289292
///
290293
/// Source: [Learn more](https://www.algolia.com/doc/api-reference/api-parameters/insideBoundingBox/)
291294
///
292-
final List<double>? insideBoundingBox;
295+
final List<List<double>>? insideBoundingBox;
293296

294297
/// Make a copy of the search state.
295298
SearchState copyWith({
@@ -322,7 +325,7 @@ class SearchState implements MultiSearchState {
322325
dynamic aroundRadius,
323326
int? aroundPrecision,
324327
int? minimumAroundRadius,
325-
List<double>? insideBoundingBox,
328+
List<List<double>>? insideBoundingBox,
326329
}) =>
327330
SearchState(
328331
attributesToHighlight:

helper/lib/src/service/algolia_hits_search_service.dart

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -74,12 +74,21 @@ class AlgoliaHitsSearchService implements HitsSearchService {
7474
try {
7575
final queryBuilder = QueryBuilder(state);
7676
final queries = queryBuilder.build().map((it) => it.toRequest()).toList();
77-
final rawResponses = await _client.searchMultiIndex(
78-
queries: queries,
77+
final responses = await _client.search(
78+
searchMethodParams: algolia.SearchMethodParams(requests: queries),
7979
);
80-
final responses = rawResponses.map((e) => e.toSearchResponse()).toList();
8180
_log.fine('Search responses: $responses');
82-
return queryBuilder.merge(responses);
81+
final unfoldedResponses = responses.results
82+
.map((result) {
83+
if (result is Map<String, dynamic>) {
84+
return algolia.SearchResponse.fromJson(result).toSearchResponse();
85+
}
86+
})
87+
.where((response) => response != null)
88+
.map((response) => response!)
89+
.toList();
90+
final foldedResponses = queryBuilder.merge(unfoldedResponses);
91+
return foldedResponses;
8392
} catch (exception) {
8493
_log.severe('Search exception thrown: $exception');
8594
throw _client.launderException(exception);

helper/pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ environment:
88
flutter: '>=1.17.0'
99
dependencies:
1010
algolia_insights: ">=0.2.2 <1.0.0"
11-
algoliasearch: ">=0.3.0 <1.0.0"
11+
algoliasearch: ">=1.2.0 <2.0.0"
1212
collection: ">=1.17.0 <2.0.0"
1313
flutter:
1414
sdk: flutter

insights/pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ environment:
88
sdk: ">=2.17.5 <4.0.0"
99
flutter: '>=1.17.0'
1010
dependencies:
11-
algolia_client_insights: ">=0.3.0 <0.4.0"
11+
algolia_client_insights: ">=1.2.0 <2.0.0"
1212
collection: ">=1.17.0 <2.0.0"
1313
flutter:
1414
sdk: flutter

0 commit comments

Comments
 (0)