Skip to content

armgit / ente

Public Imported from GitHub
0

πŸ’š End-to-end encrypted cloud for everything.

[mob] Allow injecting score threshold in query

Neeraj Gupta0c20be98d73c
diff --git a/mobile/lib/services/machine_learning/semantic_search/semantic_search_service.dart b/mobile/lib/services/machine_learning/semantic_search/semantic_search_service.dart
index ec68264142..b01d9d82c2 100644
--- a/mobile/lib/services/machine_learning/semantic_search/semantic_search_service.dart
+++ b/mobile/lib/services/machine_learning/semantic_search/semantic_search_service.dart
@@ -144,6 +144,14 @@ class SemanticSearchService {
String query, {
double? scoreThreshold,
}) async {
+ // if the query starts with 0.xxx, the split the query to get score threshold and actual query
+ if (query.startsWith(RegExp(r"0\.\d+"))) {
+ final parts = query.split(" ");
+ if (parts.length > 1) {
+ scoreThreshold = double.parse(parts[0]);
+ query = parts.sublist(1).join(" ");
+ }
+ }
final textEmbedding = await _getTextEmbedding(query);
final queryResults = await _getSimilarities(