Skip to content

Commit

Permalink
Random function
Browse files Browse the repository at this point in the history
  • Loading branch information
LaineZ committed Nov 13, 2023
1 parent 32f611e commit 7ffe986
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 47 deletions.
43 changes: 0 additions & 43 deletions .github/workflows/build.yml

This file was deleted.

15 changes: 11 additions & 4 deletions src/query/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -338,10 +338,17 @@ pub async fn search(
query.append(&filter);
query.sql(" ORDER BY ");

if sort.as_str() == "relevance" {
relevance(&mut query, &tsqueries);
} else {
query.sql("msg_timestamp");
match sort.as_str() {
"time" => {
query.sql("msg_timestamp");
},
"relevance" => {
relevance(&mut query, &tsqueries);
}
"random" => {
query.sql("RANDOM()");
}
_ => bail!("bad 'sort' function argument: either 'time', 'relevance' or 'random' expected")
}

match order.as_str() {
Expand Down

0 comments on commit 7ffe986

Please sign in to comment.