Smalyshev has uploaded a new change for review. (
https://gerrit.wikimedia.org/r/367631 )
Change subject: Properly set search limit
......................................................................
Properly set search limit
Bug: T171548
Change-Id: I6527619802b6eac98437baad46aeb21ecec16c33
Depends-On: Ib87bbe117cd7c154e10e78f76ebf8e39f7cd57a0
---
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, 20 insertions(+), 7 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Wikibase
refs/changes/31/367631/1
diff --git a/repo/includes/Search/Elastic/WikibasePrefixSearcher.php
b/repo/includes/Search/Elastic/WikibasePrefixSearcher.php
index f089fe4..b18d31e 100644
--- a/repo/includes/Search/Elastic/WikibasePrefixSearcher.php
+++ b/repo/includes/Search/Elastic/WikibasePrefixSearcher.php
@@ -54,6 +54,12 @@
if ( $highlight ) {
$searchQuery->setHighlight( $highlight );
}
+ if ( $this->offset ) {
+ $searchQuery->setFrom( $this->offset );
+ }
+ if ( $this->limit ) {
+ $searchQuery->setSize( $this->limit );
+ }
$searchQuery->setParam( 'rescore',
$this->searchContext->getRescore() );
return $pageType->createSearch( $searchQuery, $queryOptions );
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 8230968..297534c 100644
--- a/repo/tests/phpunit/data/entitySearch/search_de-ch-en.expected
+++ b/repo/tests/phpunit/data/entitySearch/search_de-ch-en.expected
@@ -112,6 +112,7 @@
}
}
},
+ "size": 10,
"rescore": [
{
"window_size": 8192,
@@ -147,4 +148,4 @@
"options": {
"timeout": "20s"
}
-}
+}
\ No newline at end of file
diff --git a/repo/tests/phpunit/data/entitySearch/search_de-ch.expected
b/repo/tests/phpunit/data/entitySearch/search_de-ch.expected
index bd3a853..6a33b2d 100644
--- a/repo/tests/phpunit/data/entitySearch/search_de-ch.expected
+++ b/repo/tests/phpunit/data/entitySearch/search_de-ch.expected
@@ -116,6 +116,7 @@
}
}
},
+ "size": 10,
"rescore": [
{
"window_size": 8192,
@@ -151,4 +152,4 @@
"options": {
"timeout": "20s"
}
-}
+}
\ No newline at end of file
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 b75b2d6..ee5d863 100644
--- a/repo/tests/phpunit/data/entitySearch/search_de-ch_strict.expected
+++ b/repo/tests/phpunit/data/entitySearch/search_de-ch_strict.expected
@@ -109,6 +109,7 @@
}
}
},
+ "size": 10,
"rescore": [
{
"window_size": 8192,
@@ -144,4 +145,4 @@
"options": {
"timeout": "20s"
}
-}
+}
\ No newline at end of file
diff --git a/repo/tests/phpunit/data/entitySearch/search_en.expected
b/repo/tests/phpunit/data/entitySearch/search_en.expected
index 5d7f639..5948bbe 100644
--- a/repo/tests/phpunit/data/entitySearch/search_en.expected
+++ b/repo/tests/phpunit/data/entitySearch/search_en.expected
@@ -90,6 +90,7 @@
}
}
},
+ "size": 10,
"rescore": [
{
"window_size": 8192,
@@ -125,4 +126,4 @@
"options": {
"timeout": "20s"
}
-}
+}
\ No newline at end of file
diff --git a/repo/tests/phpunit/data/entitySearch/search_en_strict.expected
b/repo/tests/phpunit/data/entitySearch/search_en_strict.expected
index 81c2ca3..cf1c1a1 100644
--- a/repo/tests/phpunit/data/entitySearch/search_en_strict.expected
+++ b/repo/tests/phpunit/data/entitySearch/search_en_strict.expected
@@ -89,6 +89,7 @@
}
}
},
+ "size": 10,
"rescore": [
{
"window_size": 8192,
@@ -124,4 +125,4 @@
"options": {
"timeout": "20s"
}
-}
+}
\ No newline at end of file
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 5516e22..c98d337 100644
--- a/repo/tests/phpunit/data/entitySearch/search_zh-de-ch.expected
+++ b/repo/tests/phpunit/data/entitySearch/search_zh-de-ch.expected
@@ -193,6 +193,7 @@
}
}
},
+ "size": 10,
"rescore": [
{
"window_size": 8192,
@@ -228,4 +229,4 @@
"options": {
"timeout": "20s"
}
-}
+}
\ No newline at end of file
diff --git a/repo/tests/phpunit/data/entitySearch/search_zh.expected
b/repo/tests/phpunit/data/entitySearch/search_zh.expected
index 1379194..092680e 100644
--- a/repo/tests/phpunit/data/entitySearch/search_zh.expected
+++ b/repo/tests/phpunit/data/entitySearch/search_zh.expected
@@ -207,6 +207,7 @@
}
}
},
+ "size": 10,
"rescore": [
{
"window_size": 8192,
@@ -242,4 +243,4 @@
"options": {
"timeout": "20s"
}
-}
+}
\ No newline at end of file
--
To view, visit https://gerrit.wikimedia.org/r/367631
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I6527619802b6eac98437baad46aeb21ecec16c33
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Wikibase
Gerrit-Branch: master
Gerrit-Owner: Smalyshev <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits