jenkins-bot has submitted this change and it was merged.

Change subject: Fixed drilldown full-text search for "data" tables
......................................................................


Fixed drilldown full-text search for "data" tables

Change-Id: Ib0bdfc87797fde995e7f64b224010b826fb8ef49
---
M drilldown/CargoSpecialDrilldown.php
1 file changed, 20 insertions(+), 1 deletion(-)

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



diff --git a/drilldown/CargoSpecialDrilldown.php 
b/drilldown/CargoSpecialDrilldown.php
index 135ca6d..76ce25d 100644
--- a/drilldown/CargoSpecialDrilldown.php
+++ b/drilldown/CargoSpecialDrilldown.php
@@ -1141,7 +1141,13 @@
                );
 
                if ( $this->fullTextSearchTerm != null ) {
-                       $aliasedFieldNames['pageText'] = 
'cargo___pageData._fullText';
+                       if ( $this->tableName == '_fileData' ) {
+                               $aliasedFieldNames['fileText'] = 
'cargo___fileData._fullText';
+                               $aliasedFieldNames['foundFileMatch'] = '1';
+                       } else {
+                               $aliasedFieldNames['pageText'] = 
'cargo___pageData._fullText';
+                       }
+
                        if ( $this->searchableFiles ) {
                                $aliasedFieldNames['fileName'] = 
'cargo___fileData._pageName';
                                $aliasedFieldNames['fileText'] = 
'cargo___fileData._fullText';
@@ -1174,6 +1180,15 @@
                $tableNames = array();
                $conds = array();
                $joinConds = array();
+
+               // Special quick handling for the "data" tables.
+               if ( $mainTableName == '_fileData' ) {
+                       $conds[] = CargoUtils::fullTextMatchSQL( $cdb, 
'_fileData', '_fullText', $searchTerm );
+                       return array( $tableNames, $conds, $joinConds );
+               } elseif ( $mainTableName == '_pageData' ) {
+                       $conds[] = CargoUtils::fullTextMatchSQL( $cdb, 
'_pageData', '_fullText', $searchTerm );
+                       return array( $tableNames, $conds, $joinConds );
+               }
 
                $tableNames[] = '_pageData';
                $joinConds['_pageData'] = array(
@@ -1247,6 +1262,10 @@
                        $pageName = $row['title'];
                        $curValue = array( 'title' => $pageName );
                        if ( array_key_exists( 'foundFileMatch', $row ) && 
$row['foundFileMatch'] ) {
+                               if ( array_key_exists( 'fileName', $row ) ) {
+                                       // Not used for _fileData drilldown.
+                                       $curValue[$fileNameStr] = 
$row['fileName'];
+                               }
                                $curValue[$fileNameStr] = $row['fileName'];
                                $curValue[$fileTextStr] = $row['fileText'];
                                $valuesTable[] = $curValue;

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

Gerrit-MessageType: merged
Gerrit-Change-Id: Ib0bdfc87797fde995e7f64b224010b826fb8ef49
Gerrit-PatchSet: 2
Gerrit-Project: mediawiki/extensions/Cargo
Gerrit-Branch: master
Gerrit-Owner: Yaron Koren <yaro...@gmail.com>
Gerrit-Reviewer: Yaron Koren <yaro...@gmail.com>
Gerrit-Reviewer: jenkins-bot <>

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

Reply via email to