fix: remove track limit completely from library search
- Backend now supports limit=0 meaning "no limit" - Frontend passes limit=0 to fetch all tracks - Search now works across entire library regardless of size - Virtualization handles rendering efficiently
This commit is contained in:
1 parent
3dc2e94002
commit
9504294907
3 files changed
+13
-5
No files matched your search
@@ -870,9 +870,10 @@ pub async fn library_search(
|
||||
let db = state.db.lock().await;
|
||||
|
||||
// Use optimized SQL-based filtering
|
||||
// limit = 0 means no limit (fetch all tracks)
|
||||
let tracks = db.search_with_filter(
|
||||
&query,
|
||||
limit.unwrap_or(50),
|
||||
limit.unwrap_or(0),
|
||||
include_qobuz,
|
||||
exclude_network_folders.unwrap_or(false),
|
||||
).map_err(|e| e.to_string())?;
|
||||
|
||||
@@ -1228,14 +1228,21 @@ impl LibraryDatabase {
|
||||
""
|
||||
};
|
||||
|
||||
// limit = 0 means no limit (fetch all)
|
||||
let limit_clause = if limit == 0 {
|
||||
String::new()
|
||||
} else {
|
||||
format!("LIMIT {}", limit)
|
||||
};
|
||||
|
||||
let sql = format!(
|
||||
r#"
|
||||
SELECT * FROM local_tracks
|
||||
WHERE (title LIKE ?1 OR artist LIKE ?1 OR album LIKE ?1)
|
||||
{} {}
|
||||
LIMIT ?2
|
||||
{}
|
||||
"#,
|
||||
source_filter, network_filter
|
||||
source_filter, network_filter, limit_clause
|
||||
);
|
||||
|
||||
let mut stmt = self
|
||||
@@ -1244,7 +1251,7 @@ impl LibraryDatabase {
|
||||
.map_err(|e| LibraryError::Database(e.to_string()))?;
|
||||
|
||||
let rows = stmt
|
||||
.query_map(params![&pattern, limit], |row| {
|
||||
.query_map(params![&pattern], |row| {
|
||||
Self::row_to_track(row)
|
||||
})
|
||||
.map_err(|e| LibraryError::Database(e.to_string()))?;
|
||||
|
||||
Reference in new issue
Block a user