John Erling Blad has uploaded a new change for review.
https://gerrit.wikimedia.org/r/52876
Change subject: (Bug 45881) Stop use of entity ids with wrong prefix
......................................................................
(Bug 45881) Stop use of entity ids with wrong prefix
Change-Id: Iafaca93b79d5ee2d7b9cd72d2a24fae5ba0f8d51
---
M repo/includes/api/SearchEntities.php
1 file changed, 4 insertions(+), 3 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Wikibase
refs/changes/76/52876/1
diff --git a/repo/includes/api/SearchEntities.php
b/repo/includes/api/SearchEntities.php
index 2da7df9..4a67303 100644
--- a/repo/includes/api/SearchEntities.php
+++ b/repo/includes/api/SearchEntities.php
@@ -69,7 +69,7 @@
'LIMIT' => $limit,
)
);
-
+wfDebug(">>>>>" . print_r($ids,true));
wfProfileOut( __METHOD__ );
return $ids;
}
@@ -98,12 +98,12 @@
$page =
EntityContentFactory::singleton()->getWikiPageForId( $entityId );
if ( $page->exists() ) {
$entityContent = $page->getContent();
- if ( $entityContent instanceof
\Wikibase\EntityContent ) {
+ if ( ( $entityContent instanceof
\Wikibase\EntityContent ) && ( $entityContent->getEntity()->getType() ===
$params['type'] ) ) {
$ids[] = $entityId;
}
}
}
-
+
// If still space, then merge in exact matches
if ( count( $ids ) < $limit ) {
$ids = array_merge( $ids, $this->searchEntities(
$params['language'], $params['search'], $params['type'], $limit, false ) );
@@ -115,6 +115,7 @@
$ids = array_merge( $ids, $this->searchEntities(
$params['language'], $params['search'], $params['type'], $limit, true ) );
$ids = array_unique( $ids );
}
+
// reduce any overflow
$ids = array_slice ( $ids, 0, $limit );
--
To view, visit https://gerrit.wikimedia.org/r/52876
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Iafaca93b79d5ee2d7b9cd72d2a24fae5ba0f8d51
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Wikibase
Gerrit-Branch: master
Gerrit-Owner: John Erling Blad <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits