diff --git a/lib/browse/Criteria.inc b/lib/browse/Criteria.inc index 0d5352a..6314305 100644 --- a/lib/browse/Criteria.inc +++ b/lib/browse/Criteria.inc @@ -1012,11 +1012,35 @@ class SearchableTextCriterion extends BrowseCriterion { } else { $boolean_mode = ""; } + + $p = array(); + $temp = str_replace('%', '', $aRequest[$this->getWidgetBase()]); + $keywords = explode(' ', $temp); + + for($i=0; $i 1){ + for($i=0; $igetWidgetBase()]; + } - $p = array(); - $p[0] = "MATCH(DST.document_text) AGAINST (? $boolean_mode)"; - $p[1] = KTUtil::phraseQuote($aRequest[$this->getWidgetBase()]); - // handle the boolean "not" stuff. $want_invert = KTUtil::arrayGet($aRequest, $this->getWidgetBase() . '_not'); if (is_null($want_invert) || ($want_invert == "0")) { diff --git a/lib/browse/PartialQuery.inc.php b/lib/browse/PartialQuery.inc.php index 5ae2603..86d65eb 100644 --- a/lib/browse/PartialQuery.inc.php +++ b/lib/browse/PartialQuery.inc.php @@ -272,7 +272,11 @@ class SimpleSearchQuery extends PartialQuery { // FIXME cache permission lookups, etc. var $searchable_text; - function SimpleSearchQuery($sSearchableText) { $this->searchable_text = $sSearchableText; } + function SimpleSearchQuery($sSearchableText){ + $sSearchableText = str_replace("\t", ' ', $sSearchableText); + $sSearchableText = '%'.$sSearchableText.'%'; + $this->searchable_text = $sSearchableText; + } function _getFolderQuery($aOptions = null) { $oUser = User::get($_SESSION['userID']); @@ -281,8 +285,29 @@ class SimpleSearchQuery extends PartialQuery { return $res; } list($sPermissionString, $aPermissionParams, $sPermissionJoin) = $res; - - $aPotentialWhere = array($sPermissionString, 'MATCH (FST.folder_text) AGAINST (? IN BOOLEAN MODE) <> 0'); + + $temp = str_replace('%', '', $this->searchable_text); + $keywords = explode(' ', $temp); + + for($i=0; $i 1){ + for($i=0; $isearchable_text); + if(count($keywords) > 1){ + $aParams = $keywords; + }else{ + $aParams = array($this->searchable_text); + } + $aParams = kt_array_merge($aPermissionParams, $aParams); return array($sQuery, $aParams); }