Improved ACP search function
authorMarcel Werk <burntime@woltlab.com>
Fri, 30 May 2014 13:09:58 +0000 (15:09 +0200)
committerMarcel Werk <burntime@woltlab.com>
Fri, 30 May 2014 13:09:58 +0000 (15:09 +0200)
wcfsetup/install/files/lib/system/search/acp/MenuItemACPSearchResultProvider.class.php
wcfsetup/install/files/lib/system/search/acp/OptionACPSearchResultProvider.class.php
wcfsetup/install/files/lib/system/search/acp/PackageACPSearchResultProvider.class.php
wcfsetup/install/files/lib/system/search/acp/UserGroupOptionACPSearchResultProvider.class.php

index 9149eead50a5c7fe8eeb501477b1eca650bfc344..a0438ae5a447c021c184e8f4ebb8eb5b1fa301d0 100644 (file)
@@ -23,7 +23,6 @@ class MenuItemACPSearchResultProvider extends AbstractACPSearchResultProvider im
                // search by language item
                $conditions = new PreparedStatementConditionBuilder();
                $conditions->add("languageID = ?", array(WCF::getLanguage()->languageID));
-               $conditions->add("languageItemValue LIKE ?", array($query.'%'));
                
                // filter by language item
                $languageItemsConditions = '';
@@ -34,6 +33,7 @@ class MenuItemACPSearchResultProvider extends AbstractACPSearchResultProvider im
                        $languageItemsParameters[] = $abbreviation;
                }
                $conditions->add("(".$languageItemsConditions.")", $languageItemsParameters);
+               $conditions->add("languageItemValue LIKE ?", array('%'.$query.'%'));
                
                $sql = "SELECT          languageItem, languageItemValue
                        FROM            wcf".WCF_N."_language_item
index 93ef14f9f4e2350c669dd14ffb1a5f50be627aa8..a8820ae18cbbcd69dc515ef0b8cd8e1bb783dd92 100644 (file)
@@ -29,17 +29,8 @@ class OptionACPSearchResultProvider extends AbstractCategorizedACPSearchResultPr
                // search by language item
                $conditions = new PreparedStatementConditionBuilder();
                $conditions->add("languageID = ?", array(WCF::getLanguage()->languageID));
-               $conditions->add("languageItemValue LIKE ?", array($query.'%'));
-               
-               // filter by language item
-               $languageItemsConditions = '';
-               $languageItemsParameters = array();
-               foreach (ACPSearchHandler::getInstance()->getAbbreviations('.acp.option.%') as $abbreviation) {
-                       if (!empty($languageItemsConditions)) $languageItemsConditions .= " OR ";
-                       $languageItemsConditions .= "languageItem LIKE ?";
-                       $languageItemsParameters[] = $abbreviation;
-               }
-               $conditions->add("(".$languageItemsConditions.")", $languageItemsParameters);
+               $conditions->add("languageItem LIKE ?", array('wcf.acp.option.%'));
+               $conditions->add("languageItemValue LIKE ?", array('%'.$query.'%'));
                
                $sql = "SELECT          languageItem, languageItemValue
                        FROM            wcf".WCF_N."_language_item
index b063169df95f5384b44fc095b944cca3e4b12f75..6a9f8b54bc7baedb09eef587c0f77ebdc2a78fbd 100644 (file)
@@ -29,7 +29,7 @@ class PackageACPSearchResultProvider implements IACPSearchResultProvider {
                $conditions = new PreparedStatementConditionBuilder();
                $conditions->add("languageID = ?", array(WCF::getLanguage()->languageID));
                $conditions->add("languageItem LIKE ?", array('wcf.acp.package.packageName.package%'));
-               $conditions->add("languageItemValue LIKE ?", array($query.'%'));
+               $conditions->add("languageItemValue LIKE ?", array('%'.$query.'%'));
                
                $sql = "SELECT          languageItem
                        FROM            wcf".WCF_N."_language_item
index 78833c099b0724ceb544bb61aa1be4ab66487cf4..59ead1c296e569c71e5b5d42f5598d522e169b5c 100644 (file)
@@ -29,17 +29,8 @@ class UserGroupOptionACPSearchResultProvider extends AbstractCategorizedACPSearc
                // search by language item
                $conditions = new PreparedStatementConditionBuilder();
                $conditions->add("languageID = ?", array(WCF::getLanguage()->languageID));
-               $conditions->add("languageItemValue LIKE ?", array($query.'%'));
-               
-               // filter by language item
-               $languageItemsConditions = '';
-               $languageItemsParameters = array();
-               foreach (ACPSearchHandler::getInstance()->getAbbreviations('.acp.group.option.%') as $abbreviation) {
-                       if (!empty($languageItemsConditions)) $languageItemsConditions .= " OR ";
-                       $languageItemsConditions .= "languageItem LIKE ?";
-                       $languageItemsParameters[] = $abbreviation;
-               }
-               $conditions->add("(".$languageItemsConditions.")", $languageItemsParameters);
+               $conditions->add("languageItem LIKE ?", array('wcf.acp.group.option.%'));
+               $conditions->add("languageItemValue LIKE ?", array('%'.$query.'%'));
                
                $sql = "SELECT          languageItem, languageItemValue
                        FROM            wcf".WCF_N."_language_item