mirror of
https://github.com/zarzet/SpotiFLAC-Mobile.git
synced 2026-09-30 21:29:36 +02:00
feat(library): search songs albums artists and playlists by relevance
This commit is contained in:
1 parent
7a26f3beac
commit
369afa550b
9 files changed
+1125
-188
No files matched your search
@@ -9,6 +9,7 @@ import 'package:spotiflac_android/utils/file_access.dart';
|
||||
import 'package:spotiflac_android/utils/ios_container_paths.dart';
|
||||
import 'package:spotiflac_android/services/history_database.dart';
|
||||
import 'package:spotiflac_android/services/library_cleanup.dart';
|
||||
import 'package:spotiflac_android/services/library_search.dart';
|
||||
import 'package:spotiflac_android/services/sqlite_helpers.dart' as sqlite;
|
||||
|
||||
part 'library_database_models.dart';
|
||||
@@ -64,6 +65,28 @@ class LibraryDatabase {
|
||||
|
||||
bool get searchFtsAvailable => _searchFtsAvailable ?? false;
|
||||
|
||||
Future<List<LibrarySearchHit>> searchLibrary({
|
||||
required String query,
|
||||
required LibrarySearchKind kind,
|
||||
required bool includeLocal,
|
||||
int limit = 40,
|
||||
int offset = 0,
|
||||
}) async {
|
||||
final db = await database;
|
||||
await _ensureHistoryAttached(db);
|
||||
return LibrarySearchStore(
|
||||
db,
|
||||
historyFts: HistoryDatabase.instance.searchFtsAvailable,
|
||||
localFts: searchFtsAvailable,
|
||||
).search(
|
||||
query: query,
|
||||
kind: kind,
|
||||
includeLocal: includeLocal,
|
||||
limit: limit,
|
||||
offset: offset,
|
||||
);
|
||||
}
|
||||
|
||||
Future<void> _migrateIosContainerPaths(Database db) async {
|
||||
if (!Platform.isIOS) return;
|
||||
final documents = await getApplicationDocumentsDirectory();
|
||||
|
||||
Reference in new issue
Block a user