-
Notifications
You must be signed in to change notification settings - Fork 4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
16 changed files
with
235 additions
and
54 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
13 changes: 13 additions & 0 deletions
13
packages/cloud_firestore/cloud_firestore/lib/src/vector_query_snapshot.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
// Copyright 2022, the Chromium project authors. Please see the AUTHORS file | ||
// for details. All rights reserved. Use of this source code is governed by a | ||
// BSD-style license that can be found in the LICENSE file. | ||
|
||
part of cloud_firestore; | ||
|
||
/// [VectorQuerySnapshot] represents a response to an [VectorQuery] request. | ||
class VectorQuerySnapshot extends _JsonQuerySnapshot { | ||
VectorQuerySnapshot._( | ||
super.firestore, | ||
super.delegate, | ||
) : super(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
60 changes: 60 additions & 0 deletions
60
...loud_firestore_platform_interface/lib/src/method_channel/method_channel_vector_query.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
// Copyright 2022, the Chromium project authors. Please see the AUTHORS file | ||
// for details. All rights reserved. Use of this source code is governed by a | ||
// BSD-style license that can be found in the LICENSE file. | ||
|
||
import 'package:cloud_firestore_platform_interface/src/method_channel/method_channel_query_snapshot.dart'; | ||
import 'package:cloud_firestore_platform_interface/src/method_channel/utils/exception.dart'; | ||
|
||
import '../../cloud_firestore_platform_interface.dart'; | ||
import 'method_channel_firestore.dart'; | ||
|
||
/// An implementation of [VectorQueryPlatform] for the [MethodChannel] | ||
class MethodChannelVectorQuery extends VectorQueryPlatform { | ||
MethodChannelVectorQuery( | ||
this.firestore, | ||
query, | ||
this._pigeonParameters, | ||
this._path, | ||
this._pigeonApp, | ||
this._queryVector, | ||
this._limit, | ||
this._distanceMeasure, | ||
this._options, | ||
this._isCollectionGroupQuery, | ||
) : super(query); | ||
|
||
final FirebaseFirestorePlatform firestore; | ||
final FirestorePigeonFirebaseApp _pigeonApp; | ||
final String _path; | ||
final PigeonQueryParameters _pigeonParameters; | ||
final bool _isCollectionGroupQuery; | ||
|
||
final int _limit; | ||
final DistanceMeasure _distanceMeasure; | ||
final List<double> _queryVector; | ||
final VectorQueryOptions _options; | ||
|
||
@override | ||
Future<MethodChannelQuerySnapshot> get({ | ||
required VectorSource source, | ||
}) async { | ||
try { | ||
final PigeonQuerySnapshot result = | ||
await MethodChannelFirebaseFirestore.pigeonChannel.findNearest( | ||
_pigeonApp, | ||
_path, | ||
_isCollectionGroupQuery, | ||
_pigeonParameters, | ||
_queryVector, | ||
source, | ||
_limit, | ||
_options, | ||
_distanceMeasure, | ||
); | ||
|
||
return MethodChannelQuerySnapshot(firestore, result); | ||
} catch (e, stack) { | ||
convertPlatformException(e, stack); | ||
} | ||
} | ||
} |
Oops, something went wrong.