[MediaWiki-commits] [Gerrit] mediawiki...Wikibase[master]: Add stats parameter for search query, for ES tracking

2017-08-08 Thread jenkins-bot (Code Review)
jenkins-bot has submitted this change and it was merged. ( 
https://gerrit.wikimedia.org/r/370763 )

Change subject: Add stats parameter for search query, for ES tracking
..


Add stats parameter for search query, for ES tracking

Bug: T172422
Change-Id: I8964981c1e576a3b8732fbb6eb67218db8ce40dc
---
M repo/includes/Search/Elastic/WikibasePrefixSearcher.php
M repo/tests/phpunit/data/entitySearch/search_de-ch-en.expected
M repo/tests/phpunit/data/entitySearch/search_de-ch.expected
M repo/tests/phpunit/data/entitySearch/search_de-ch_strict.expected
M repo/tests/phpunit/data/entitySearch/search_en.expected
M repo/tests/phpunit/data/entitySearch/search_en_strict.expected
M repo/tests/phpunit/data/entitySearch/search_zh-de-ch.expected
M repo/tests/phpunit/data/entitySearch/search_zh.expected
8 files changed, 23 insertions(+), 0 deletions(-)

Approvals:
  EBernhardson: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/repo/includes/Search/Elastic/WikibasePrefixSearcher.php 
b/repo/includes/Search/Elastic/WikibasePrefixSearcher.php
index 71331bd..879a0af 100644
--- a/repo/includes/Search/Elastic/WikibasePrefixSearcher.php
+++ b/repo/includes/Search/Elastic/WikibasePrefixSearcher.php
@@ -61,6 +61,8 @@
$searchQuery->setSize( $this->limit );
}
$searchQuery->setParam( 'rescore', 
$this->searchContext->getRescore() );
+   // Mark wikibase prefix searches for statistics
+   $searchQuery->addParam( 'stats', 'wikibase-prefix' );
 
if ( $this->returnExplain ) {
$searchQuery->setExplain( true );
diff --git a/repo/tests/phpunit/data/entitySearch/search_de-ch-en.expected 
b/repo/tests/phpunit/data/entitySearch/search_de-ch-en.expected
index 297534c..17473e8 100644
--- a/repo/tests/phpunit/data/entitySearch/search_de-ch-en.expected
+++ b/repo/tests/phpunit/data/entitySearch/search_de-ch-en.expected
@@ -143,6 +143,9 @@
 }
 }
 }
+],
+"stats": [
+"wikibase-prefix"
 ]
 },
 "options": {
diff --git a/repo/tests/phpunit/data/entitySearch/search_de-ch.expected 
b/repo/tests/phpunit/data/entitySearch/search_de-ch.expected
index 7c22e89..a34d3b8 100644
--- a/repo/tests/phpunit/data/entitySearch/search_de-ch.expected
+++ b/repo/tests/phpunit/data/entitySearch/search_de-ch.expected
@@ -147,6 +147,9 @@
 }
 }
 }
+],
+"stats": [
+"wikibase-prefix"
 ]
 },
 "options": {
diff --git a/repo/tests/phpunit/data/entitySearch/search_de-ch_strict.expected 
b/repo/tests/phpunit/data/entitySearch/search_de-ch_strict.expected
index ee5d863..c35cd63 100644
--- a/repo/tests/phpunit/data/entitySearch/search_de-ch_strict.expected
+++ b/repo/tests/phpunit/data/entitySearch/search_de-ch_strict.expected
@@ -140,6 +140,9 @@
 }
 }
 }
+],
+"stats": [
+"wikibase-prefix"
 ]
 },
 "options": {
diff --git a/repo/tests/phpunit/data/entitySearch/search_en.expected 
b/repo/tests/phpunit/data/entitySearch/search_en.expected
index 5948bbe..75f7a64 100644
--- a/repo/tests/phpunit/data/entitySearch/search_en.expected
+++ b/repo/tests/phpunit/data/entitySearch/search_en.expected
@@ -121,6 +121,9 @@
 }
 }
 }
+],
+"stats": [
+"wikibase-prefix"
 ]
 },
 "options": {
diff --git a/repo/tests/phpunit/data/entitySearch/search_en_strict.expected 
b/repo/tests/phpunit/data/entitySearch/search_en_strict.expected
index 42f0864..9b0076a 100644
--- a/repo/tests/phpunit/data/entitySearch/search_en_strict.expected
+++ b/repo/tests/phpunit/data/entitySearch/search_en_strict.expected
@@ -120,6 +120,9 @@
 }
 }
 }
+],
+"stats": [
+"wikibase-prefix"
 ]
 },
 "options": {
diff --git a/repo/tests/phpunit/data/entitySearch/search_zh-de-ch.expected 
b/repo/tests/phpunit/data/entitySearch/search_zh-de-ch.expected
index c98d337..bfc0ae0 100644
--- a/repo/tests/phpunit/data/entitySearch/search_zh-de-ch.expected
+++ b/repo/tests/phpunit/data/entitySearch/search_zh-de-ch.expected
@@ -224,6 +224,9 @@
 }
 }
 }
+],
+"stats": [
+"wikibase-prefix"
 ]
 },
 "options": {
diff --git a/repo/tests/phpunit/data/entitySearch/search_zh.expected 
b/repo/tests/phpunit/data/entitySearch/search_zh.expected
index 092680e..56a0756 100644
--- a/repo/tests/phpunit/data/entitySearch/search_zh.expected
+++ b/repo/tests/phpunit/data/entitySearch/search_zh.expected
@@ -238,6 +238,9 @@
 }
 }
 }
+],
+"stats": [
+

[MediaWiki-commits] [Gerrit] mediawiki...Wikibase[master]: Add stats parameter for search query, for ES tracking

2017-08-08 Thread Smalyshev (Code Review)
Smalyshev has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/370763 )

Change subject: Add stats parameter for search query, for ES tracking
..

Add stats parameter for search query, for ES tracking

Bug: T172422
Change-Id: I8964981c1e576a3b8732fbb6eb67218db8ce40dc
---
M repo/includes/Search/Elastic/WikibasePrefixSearcher.php
M repo/tests/phpunit/data/entitySearch/search_de-ch-en.expected
M repo/tests/phpunit/data/entitySearch/search_de-ch.expected
M repo/tests/phpunit/data/entitySearch/search_de-ch_strict.expected
M repo/tests/phpunit/data/entitySearch/search_en.expected
M repo/tests/phpunit/data/entitySearch/search_en_strict.expected
M repo/tests/phpunit/data/entitySearch/search_zh-de-ch.expected
M repo/tests/phpunit/data/entitySearch/search_zh.expected
8 files changed, 23 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Wikibase 
refs/changes/63/370763/1

diff --git a/repo/includes/Search/Elastic/WikibasePrefixSearcher.php 
b/repo/includes/Search/Elastic/WikibasePrefixSearcher.php
index 71331bd..879a0af 100644
--- a/repo/includes/Search/Elastic/WikibasePrefixSearcher.php
+++ b/repo/includes/Search/Elastic/WikibasePrefixSearcher.php
@@ -61,6 +61,8 @@
$searchQuery->setSize( $this->limit );
}
$searchQuery->setParam( 'rescore', 
$this->searchContext->getRescore() );
+   // Mark wikibase prefix searches for statistics
+   $searchQuery->addParam( 'stats', 'wikibase-prefix' );
 
if ( $this->returnExplain ) {
$searchQuery->setExplain( true );
diff --git a/repo/tests/phpunit/data/entitySearch/search_de-ch-en.expected 
b/repo/tests/phpunit/data/entitySearch/search_de-ch-en.expected
index 297534c..17473e8 100644
--- a/repo/tests/phpunit/data/entitySearch/search_de-ch-en.expected
+++ b/repo/tests/phpunit/data/entitySearch/search_de-ch-en.expected
@@ -143,6 +143,9 @@
 }
 }
 }
+],
+"stats": [
+"wikibase-prefix"
 ]
 },
 "options": {
diff --git a/repo/tests/phpunit/data/entitySearch/search_de-ch.expected 
b/repo/tests/phpunit/data/entitySearch/search_de-ch.expected
index 7c22e89..a34d3b8 100644
--- a/repo/tests/phpunit/data/entitySearch/search_de-ch.expected
+++ b/repo/tests/phpunit/data/entitySearch/search_de-ch.expected
@@ -147,6 +147,9 @@
 }
 }
 }
+],
+"stats": [
+"wikibase-prefix"
 ]
 },
 "options": {
diff --git a/repo/tests/phpunit/data/entitySearch/search_de-ch_strict.expected 
b/repo/tests/phpunit/data/entitySearch/search_de-ch_strict.expected
index ee5d863..c35cd63 100644
--- a/repo/tests/phpunit/data/entitySearch/search_de-ch_strict.expected
+++ b/repo/tests/phpunit/data/entitySearch/search_de-ch_strict.expected
@@ -140,6 +140,9 @@
 }
 }
 }
+],
+"stats": [
+"wikibase-prefix"
 ]
 },
 "options": {
diff --git a/repo/tests/phpunit/data/entitySearch/search_en.expected 
b/repo/tests/phpunit/data/entitySearch/search_en.expected
index 5948bbe..75f7a64 100644
--- a/repo/tests/phpunit/data/entitySearch/search_en.expected
+++ b/repo/tests/phpunit/data/entitySearch/search_en.expected
@@ -121,6 +121,9 @@
 }
 }
 }
+],
+"stats": [
+"wikibase-prefix"
 ]
 },
 "options": {
diff --git a/repo/tests/phpunit/data/entitySearch/search_en_strict.expected 
b/repo/tests/phpunit/data/entitySearch/search_en_strict.expected
index 42f0864..9b0076a 100644
--- a/repo/tests/phpunit/data/entitySearch/search_en_strict.expected
+++ b/repo/tests/phpunit/data/entitySearch/search_en_strict.expected
@@ -120,6 +120,9 @@
 }
 }
 }
+],
+"stats": [
+"wikibase-prefix"
 ]
 },
 "options": {
diff --git a/repo/tests/phpunit/data/entitySearch/search_zh-de-ch.expected 
b/repo/tests/phpunit/data/entitySearch/search_zh-de-ch.expected
index c98d337..bfc0ae0 100644
--- a/repo/tests/phpunit/data/entitySearch/search_zh-de-ch.expected
+++ b/repo/tests/phpunit/data/entitySearch/search_zh-de-ch.expected
@@ -224,6 +224,9 @@
 }
 }
 }
+],
+"stats": [
+"wikibase-prefix"
 ]
 },
 "options": {
diff --git a/repo/tests/phpunit/data/entitySearch/search_zh.expected 
b/repo/tests/phpunit/data/entitySearch/search_zh.expected
index 092680e..56a0756 100644
--- a/repo/tests/phpunit/data/entitySearch/search_zh.expected
+++ b/repo/tests/phpunit/data/entitySearch/search_zh.expected
@@ -238,6 +238,9 @@
 }
 }
 }
+],
+"stats": [
+