Skip to content

Commit

Permalink
Ticket #4558 - Build-in API support: Search.
Browse files Browse the repository at this point in the history
  • Loading branch information
AntonLV committed Jan 18, 2024
1 parent 0d34bbd commit 6250486
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions inc/classes/BxDolSearch.php
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ public function response ()
if($bSingle)
$sCode = $oEx->decodeDataAPI($oEx->getSearchData());
else
$sCode[$sKey] = $oEx->getSearchQuery();
$sCode[$sKey] = $oEx->getSearchQuery($sKey);
}
else
$sCode[$sKey] = $oEx->getSearchData();
Expand All @@ -136,7 +136,8 @@ public function response ()

$aQueries = [];
foreach($sCode as $aQuery)
$aQueries[] = $aQuery['query'];
if(!empty($aQuery['query']))
$aQueries[] = $aQuery['query'];

$aItems = BxDolDb::getInstance()->getAll('(' . implode(') UNION (', $aQueries) . ') ORDER BY `added` DESC ' . current($sCode)['limit']);

Expand Down Expand Up @@ -760,7 +761,7 @@ function getSearchData ()
* @param type $aParams array with params
* @return type array with query and limit
*/
function getSearchQuery($aParams = [])
function getSearchQuery($sObject, $aParams = [])
{
if(!is_array($aParams))
$aParams = [];
Expand All @@ -777,6 +778,7 @@ function getSearchQuery($aParams = [])
bx_alert('simple_search', 'get_query', 0, false, [
'object' => &$this->aCurrent,
'mode' => $this->_sMode,
'search_object' => $sObject,
'search_query' => &$aQuery
]);

Expand Down

0 comments on commit 6250486

Please sign in to comment.