Skip to content

Commit

Permalink
spi-search:fix.
Browse files Browse the repository at this point in the history
  • Loading branch information
ljl committed Oct 18, 2023
1 parent e66997f commit 223c726
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions spi/spi-search/src/serv/pg/search_pg_item_serv.rs
Original file line number Diff line number Diff line change
Expand Up @@ -709,7 +709,9 @@ pub async fn query_metrics(query_req: &SearchQueryMetricsReq, funs: &TardisFunsI
}
sql_part_or_wheres.push(sql_part_and_wheres.join(" AND "));
}
sql_part_wheres.push(format!("( {} )", sql_part_or_wheres.join(" OR ")));
if !sql_part_or_wheres.is_empty() {
sql_part_wheres.push(format!("( {} )", sql_part_or_wheres.join(" OR ")));
}
}

// Add visit_keys filter
Expand All @@ -734,7 +736,7 @@ pub async fn query_metrics(query_req: &SearchQueryMetricsReq, funs: &TardisFunsI
}
if !where_visit_keys_fragments.is_empty() {
sql_part_wheres.push(format!(
" AND (fact.visit_keys IS NULL OR ({}))",
" (fact.visit_keys IS NULL OR ({}))",
where_visit_keys_fragments.join(if query_req.ctx.cond_by_or.unwrap_or(false) { " OR " } else { " AND " })
));
}
Expand Down

0 comments on commit 223c726

Please sign in to comment.