Skip to content

Commit

Permalink
Fix negated query tag
Browse files Browse the repository at this point in the history
  • Loading branch information
LetrixZ committed Jun 30, 2024
1 parent a5e429f commit 77fb740
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 5 deletions.
2 changes: 1 addition & 1 deletion server/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion server/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "server"
version = "1.1.1"
version = "1.1.2"
edition = "2021"

[dependencies]
Expand Down
10 changes: 8 additions & 2 deletions server/src/db.rs
Original file line number Diff line number Diff line change
Expand Up @@ -502,7 +502,10 @@ fn add_tag_matches(qb: &mut QueryBuilder<Postgres>, value: &str) {
let push_taxonomy_sql = |qb: &mut QueryBuilder<Postgres>, tag_type: TagType, value: String| {
qb.push(get_sql(&tag_type, "name"))
.push_bind(value.clone())
.push(format!("\n ) OR\n {condition} (\n "))
.push(format!(
"\n ) {condition_op}\n {condition} (\n ",
condition_op = if negate { "AND" } else { "OR" }
))
.push(get_sql(&tag_type, "slug"))
.push_bind(value)
.push("\n )\n )\n".to_string());
Expand All @@ -513,7 +516,10 @@ fn add_tag_matches(qb: &mut QueryBuilder<Postgres>, value: &str) {
qb.push(get_sql(&tag_type, "name"))
.push_bind(value.clone())
.push(format!(" AND namespace ILIKE '{namespace}'"))
.push(format!("\n ) OR\n {condition} (\n "))
.push(format!(
"\n ) {condition_op}\n {condition} (\n ",
condition_op = if negate { "AND" } else { "OR" }
))
.push(get_sql(&tag_type, "slug"))
.push_bind(value)
.push(format!(" AND namespace ILIKE '{namespace}'"))
Expand Down
2 changes: 1 addition & 1 deletion web/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "web-kit",
"version": "1.1.1",
"version": "1.1.2",
"private": true,
"scripts": {
"dev": "vite dev",
Expand Down

0 comments on commit 77fb740

Please sign in to comment.