Skip to content

Commit

Permalink
feature: get rate of no clicks
Browse files Browse the repository at this point in the history
  • Loading branch information
densumesh authored and skeptrunedev committed Aug 16, 2024
1 parent 3752a58 commit 43ec656
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
5 changes: 5 additions & 0 deletions server/src/data/models.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4371,13 +4371,15 @@ impl From<SearchLatencyGraphClickhouse> for SearchLatencyGraph {
pub struct SearchCTRMetricsClickhouse {
pub searches_with_clicks: i64,
pub percent_searches_with_clicks: f64,
pub percent_searches_without_clicks: f64,
pub avg_position_of_click: f64,
}

#[derive(Debug, Row, Serialize, Deserialize, ToSchema)]
pub struct SearchCTRMetrics {
pub searches_with_clicks: i64,
pub percent_searches_with_clicks: f64,
pub percent_searches_without_clicks: f64,
pub avg_position_of_click: f64,
}

Expand All @@ -4388,6 +4390,9 @@ impl From<SearchCTRMetricsClickhouse> for SearchCTRMetrics {
percent_searches_with_clicks: f64::from_be_bytes(
metrics.percent_searches_with_clicks.to_be_bytes(),
),
percent_searches_without_clicks: f64::from_be_bytes(
metrics.percent_searches_without_clicks.to_be_bytes(),
),
avg_position_of_click: f64::from_be_bytes(metrics.avg_position_of_click.to_be_bytes()),
}
}
Expand Down
1 change: 1 addition & 0 deletions server/src/operators/analytics_operator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -877,6 +877,7 @@ pub async fn get_search_ctr_metrics_query(
SELECT
searches_with_clicks,
(searches_with_clicks * 100.0 / total) AS percent_searches_with_click,
((total - searches_with_clicks) * 100.0 / total) AS percent_searches_without_click,
avg_position_of_click
FROM (
SELECT
Expand Down

0 comments on commit 43ec656

Please sign in to comment.