Implementation
Future<List<SearchResult>> singleSearch(Template template, TemplateIndex templatesIndex, int k,
{SearchAccelerationType acceleration = SearchAccelerationType.SEARCH_ACCELERATION_1}) async {
ReceivePort receivePort = ReceivePort();
List<SearchResult> result = [];
_sendPort.send({
"event": _RecognizerEvents.SINGLE_SEARCH,
"sendPort": receivePort.sendPort,
"template": template._impl.address,
"templateIndex": templatesIndex._impl.address,
"k": k,
"acceleration": acceleration
});
List<Map<String, dynamic>> data = await receivePort.first;
for (Map<String, dynamic> mapData in data) {
result.add(SearchResult(mapData["i"], MatchResult(mapData["distance"]!, mapData["fa_r"]!, mapData["fr_r"]!, mapData["score"]!)));
}
return result;
}