Yaron Koren has uploaded a new change for review.

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


Change subject: More SQL fixes for when SMW ID is not unique
......................................................................

More SQL fixes for when SMW ID is not unique

Change-Id: I4138c502cd55272791be85eaf82a3107895bd584
---
M specials/SD_BrowseData.php
1 file changed, 2 insertions(+), 2 deletions(-)


  git pull 
ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/SemanticDrilldown 
refs/changes/58/80558/1

diff --git a/specials/SD_BrowseData.php b/specials/SD_BrowseData.php
index 2fe2b09..ceabaf8 100644
--- a/specials/SD_BrowseData.php
+++ b/specials/SD_BrowseData.php
@@ -355,7 +355,7 @@
                        $value_field = $af->filter->getValueField();
                        if ( $af->filter->property_type === 'page' ) {
                                $property_field = "r$i.p_id";
-                               $sql .= "\n     AND ($property_field = (SELECT 
smw_id FROM $smwIDs WHERE smw_title = '$property_value' AND smw_namespace = 
$prop_ns)";
+                               $sql .= "\n     AND ($property_field = (SELECT 
MAX(smw_id) FROM $smwIDs WHERE smw_title = '$property_value' AND smw_namespace 
= $prop_ns)";
                                if ( $includes_none ) {
                                        $sql .= " OR $property_field IS NULL";
                                }
@@ -363,7 +363,7 @@
                                $value_field = "o_ids$i.smw_title";
                        } else {
                                $property_field = "a$i.p_id";
-                               $sql .= "\n     AND $property_field = (SELECT 
smw_id FROM $smwIDs WHERE smw_title = '$property_value' AND smw_namespace = 
$prop_ns) AND ";
+                               $sql .= "\n     AND $property_field = (SELECT 
MAX(smw_id) FROM $smwIDs WHERE smw_title = '$property_value' AND smw_namespace 
= $prop_ns) AND ";
                                if ( $af->filter->property_type === 'date' ) {
                                        $value_field = 
"SUBSTRING(a$i.$value_field, 3)";
                                } else {

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I4138c502cd55272791be85eaf82a3107895bd584
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/SemanticDrilldown
Gerrit-Branch: master
Gerrit-Owner: Yaron Koren <yaro...@gmail.com>

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

Reply via email to