mirror of
https://github.com/agersant/polaris
synced 2024-11-10 10:14:12 +00:00
Defined SQL random
This commit is contained in:
parent
48f5ea9f88
commit
9a9abbe39d
1 changed files with 3 additions and 1 deletions
|
@ -23,6 +23,8 @@ use metadata;
|
|||
const INDEX_BUILDING_INSERT_BUFFER_SIZE: usize = 1000; // Insertions in each transaction
|
||||
const INDEX_BUILDING_CLEAN_BUFFER_SIZE: usize = 500; // Insertions in each transaction
|
||||
|
||||
no_arg_sql_function!(random, types::Integer, "Represents the SQL RANDOM() function");
|
||||
|
||||
pub enum Command {
|
||||
REINDEX,
|
||||
}
|
||||
|
@ -550,7 +552,7 @@ pub fn get_random_albums<T>(db: &T, count: i64) -> Result<Vec<Directory>>
|
|||
let real_directories = directories
|
||||
.filter(album.is_not_null())
|
||||
.limit(count)
|
||||
.order(sql::<types::Bool>("RANDOM()"))
|
||||
.order(random)
|
||||
.load(connection)?;
|
||||
let virtual_directories = real_directories
|
||||
.into_iter()
|
||||
|
|
Loading…
Reference in a new issue