jenkins-bot has submitted this change and it was merged. (
https://gerrit.wikimedia.org/r/360358 )
Change subject: Add noop hints for LabelsField
......................................................................
Add noop hints for LabelsField
Needed to make sure that deleted labels/aliases are actually deleted
in the index.
Bug: T166589
Change-Id: I6851a5f58716267f312801b1a6e91388e474d8fa
Depends-On: Idc4ae06f76d0e70eaee7e84212cd19e2282a6fb9
---
M repo/includes/Search/Elastic/Fields/LabelsField.php
M repo/tests/phpunit/includes/Search/Elastic/Fields/LabelsFieldTest.php
2 files changed, 20 insertions(+), 0 deletions(-)
Approvals:
Smalyshev: Looks good to me, approved
jenkins-bot: Verified
diff --git a/repo/includes/Search/Elastic/Fields/LabelsField.php
b/repo/includes/Search/Elastic/Fields/LabelsField.php
index e9d3716..d2f84b3 100644
--- a/repo/includes/Search/Elastic/Fields/LabelsField.php
+++ b/repo/includes/Search/Elastic/Fields/LabelsField.php
@@ -82,4 +82,12 @@
return $data;
}
+ public function getEngineHints( SearchEngine $engine ) {
+ if ( !( $engine instanceof CirrusSearch ) ) {
+ // For now only Cirrus/Elastic is supported
+ return [];
+ }
+ return [ \CirrusSearch\Search\CirrusIndexField::NOOP_HINT =>
"equals" ];
+ }
+
}
diff --git
a/repo/tests/phpunit/includes/Search/Elastic/Fields/LabelsFieldTest.php
b/repo/tests/phpunit/includes/Search/Elastic/Fields/LabelsFieldTest.php
index c71ff07..5ffa232 100644
--- a/repo/tests/phpunit/includes/Search/Elastic/Fields/LabelsFieldTest.php
+++ b/repo/tests/phpunit/includes/Search/Elastic/Fields/LabelsFieldTest.php
@@ -88,4 +88,16 @@
$this->assertSame( [], $labels->getMapping( $searchEngine ) );
}
+ public function testHints() {
+ $labels = new LabelsField( [ 'en', 'es', 'ru', 'de' ] );
+ if ( !class_exists( CirrusSearch::class ) ) {
+ $searchEngine = $this->getMockBuilder(
SearchEngine::class )->getMock();
+ $this->assertEquals( [], $labels->getEngineHints(
$searchEngine ) );
+ } else {
+ $searchEngine = $this->getMockBuilder(
CirrusSearch::class )->getMock();
+ $this->assertEquals( [ 'noop' => 'equals' ],
+ $labels->getEngineHints( $searchEngine ) );
+ }
+ }
+
}
--
To view, visit https://gerrit.wikimedia.org/r/360358
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I6851a5f58716267f312801b1a6e91388e474d8fa
Gerrit-PatchSet: 6
Gerrit-Project: mediawiki/extensions/Wikibase
Gerrit-Branch: master
Gerrit-Owner: DCausse <[email protected]>
Gerrit-Reviewer: Aude <[email protected]>
Gerrit-Reviewer: Smalyshev <[email protected]>
Gerrit-Reviewer: Thiemo Mättig (WMDE) <[email protected]>
Gerrit-Reviewer: jenkins-bot <>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits