Bearloga has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/316490

Change subject: [WIP] Fix PaulScore & update TSS2 refs
......................................................................

[WIP] Fix PaulScore & update TSS2 refs

- Fixes PaulScore calculation for autocomplete events
  using the new did you mean event logging
- Updates the revision number for TestSearchSatisfaction2
  schema that integrates did you mean
  NOTE: the new revision won't activate until 2016-10-25
  which is when I8983a9677ffd9d98c8a347ef0961c2f0e874393f
  is scheduled for deployment; so do not merge until then

Bug: T144424
Change-Id: Ic832def4db6fa95d106a5a7dd780ec220b3e66cd
---
M search/paulscore.R
1 file changed, 18 insertions(+), 16 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/wikimedia/discovery/golden 
refs/changes/90/316490/1

diff --git a/search/paulscore.R b/search/paulscore.R
index e6d2fd3..6119bef 100644
--- a/search/paulscore.R
+++ b/search/paulscore.R
@@ -10,23 +10,25 @@
   date <- gsub(x = date, pattern = "-", replacement = "")
   
   query <- paste0("SELECT
-  date, event_source,
-  ", paste0("ROUND(SUM(pow_", 1:9,")/COUNT(1), 3) AS pow_", 1:9, collapse = 
",\n  "), "
-FROM (
-  SELECT
-    LEFT(timestamp, 8) AS date,
-    event_source,
-    event_searchSessionId,
-    ", paste0("SUM(IF(event_action = 'click', POW(0.", 1:9, ", 
event_position), 0)) / SUM(IF(event_action = 'searchResultPage', 1, 0)) AS 
pow_", 1:9, collapse = ",\n    "), "
-  FROM TestSearchSatisfaction2_15922352
-  WHERE
-    LEFT(timestamp, 8) = '", date, "'
-    AND event_action IN ('searchResultPage', 'click')
-    AND (event_subTest IS NULL OR event_subTest IN ('null','baseline'))
-  GROUP BY date, event_source, event_searchSessionId
-) AS pows
-GROUP BY date, event_source;") # cat(query) if you want to copy and paste into 
MySQL CLI
+    date, event_source,
+    ", paste0("ROUND(SUM(pow_", 1:9,")/COUNT(1), 3) AS pow_", 1:9, collapse = 
",\n  "), "
+    FROM (
+      SELECT
+        event_searchSessionId,
+        event_source,
+        LEFT(MIN(timestamp), 8) as date,
+        ", paste0("SUM(IF(event_action = 'click', POW(0.", 1:9, ", 
event_position), 0)) / SUM(IF(event_action = 'searchResultPage', 1, 0)) AS 
pow_", 1:9, collapse = ",\n    "), "
+      FROM TestSearchSatisfaction2_15922352
+      WHERE
+        LEFT(timestamp, 8) = '", date, "'
+        AND event_action IN ('searchResultPage', 'click')
+        AND IF(event_source = 'autocomplete', event_inputLocation = 'header', 
TRUE)
+        AND IF(event_source = 'autocomplete' AND event_action = 'click', 
event_position >= 0, TRUE)
+        GROUP BY event_searchSessionId, event_source
+    ) AS pows
+    GROUP BY date, event_source;") # cat(query) if you want to copy and paste 
into MySQL CLI
   # See https://phabricator.wikimedia.org/T144424 for more details.
+  
   data <- wmf::mysql_read(query, "log")
   data$date <- lubridate::ymd(data$date)
   

-- 
To view, visit https://gerrit.wikimedia.org/r/316490
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ic832def4db6fa95d106a5a7dd780ec220b3e66cd
Gerrit-PatchSet: 1
Gerrit-Project: wikimedia/discovery/golden
Gerrit-Branch: master
Gerrit-Owner: Bearloga <mpo...@wikimedia.org>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to