@@ -4,6 +4,7 @@ import 'package:alfred_noteplan/folder.dart';
4
4
import 'package:alfred_noteplan/note.dart' ;
5
5
import 'package:alfred_noteplan/note_match.dart' ;
6
6
import 'package:alfred_noteplan/snippet.dart' ;
7
+ import 'package:alfred_noteplan/strings.dart' ;
7
8
import 'package:path/path.dart' ;
8
9
import 'package:sqlite3/sqlite3.dart' ;
9
10
@@ -148,10 +149,8 @@ class Dbs {
148
149
''' ).execute ([timestamp ?? DateTime .now ().millisecondsSinceEpoch]);
149
150
}
150
151
151
- }
152
-
153
- List <NoteMatch > search (String query) {
154
- final String preparedQuery = _query_to_fts_query (query);
152
+ List <NoteMatch > search_notes (String query) {
153
+ final String preparedQuery = query.toFtsQuery ();
155
154
final ResultSet results = _db.select ('''
156
155
SELECT
157
156
filename,
@@ -169,6 +168,45 @@ class Dbs {
169
168
return results.map ((Row row) => NoteMatch (row)).toList (growable: false );
170
169
}
171
170
171
+ List <Map <String , dynamic >> search_bookmarks (String query) {
172
+ final String preparedQuery = query.toFtsQuery ();
173
+ final ResultSet results = _db.select ('''
174
+ SELECT
175
+ filename,
176
+ note_type,
177
+ title,
178
+ url
179
+ FROM
180
+ main.bookmarks('${preparedQuery }')
181
+ ORDER BY
182
+ rank
183
+ LIMIT
184
+ 18
185
+ ''' );
186
+
187
+ return results.map ((Row result) => Bookmark .to_alfred_result (result)).toList (growable: false );
188
+ }
189
+
190
+ List <Map <String , dynamic >> search_snippets (String query) {
191
+ final String preparedQuery = query.toFtsQuery ();
192
+ final ResultSet results = _db.select ('''
193
+ SELECT
194
+ filename,
195
+ note_type,
196
+ language,
197
+ title,
198
+ content
199
+ FROM
200
+ main.snippets('${preparedQuery }')
201
+ ORDER BY
202
+ rank
203
+ LIMIT
204
+ 18
205
+ ''' );
206
+
207
+ return results.map ((Row result) => Snippet .to_alfred_result (result)).toList (growable: false );
208
+ }
209
+
172
210
ResultSet cache_get_updated ({int since = 0 }) {
173
211
final String ignore_condition = Config .ignore.isEmpty
174
212
? ''
0 commit comments