lib/controllers/ObjectController.php
public function actionSearch()
    {
        $package = [];
        $defaultParams = ['typeFilters' => []];
        $searchParams = array_merge($defaultParams, $_GET);

        if (empty($searchParams['term'])) {
            Yii::$app->response->data = $package;
            return;
        }

        if (isset($searchParams['modules']) && !is_array($searchParams['modules'])) {
            $searchParams['modules'] = implode(',', $searchParams['modules']);
        }

        $modules = isset($searchParams['modules']) ? (array) $searchParams['modules'] : array_keys(Yii::$app->collectors['types']->getAll());
        $params = ['ignore' => [], 'ignoreChildren' => [], 'ignoreParents' => []];
        if (!empty($searchParams['ignore'])) {
            $params['ignore'] = (array) $searchParams['ignore'];
        }
        if (!empty($searchParams['ignoreChildren'])) {
            $params['ignoreChildren'] = (array) $searchParams['ignoreChildren'];
        }
        if (!empty($searchParams['ignoreParents'])) {
            $params['ignoreParents'] = (array) $searchParams['ignoreParents'];
        }
        $params['action'] = 'read';
        $params['modules'] = $modules;
        $term = $searchParams['term'];
        $params['limit'] = 8;
        $scores = [];
        foreach ($modules as $module) {
            $moduleItem = Yii::$app->collectors['types']->getOne($module);
            if (!$moduleItem || !($moduleObject = $moduleItem->object)) {
                continue;
            }
            if (!(isset($searchParams['modules']) && in_array($moduleItem->systemId, $searchParams['modules'])) && empty($moduleItem->object->searchWeight)) {
                continue;
            }
            if (in_array('authority', $searchParams['typeFilters']) && $moduleItem->object->getBehavior('Authority') === null) {
                continue;
            }
            if (in_array('dashboard', $searchParams['typeFilters']) && !$moduleItem->object->hasDashboard) {
                continue;
            }
            $moduleResults = $moduleObject->search($term, $params);
            foreach ($moduleResults as $r) {
                $package[] = $r;
            }
        }
        ArrayHelper::multisort($package, 'scoreSort', SORT_DESC);
        foreach (array_slice($package, 0, 30) as $key => $result) {
            $package[$key] = $result->toArray();
        }
        Yii::$app->response->data = $package;
    }
public function actionSearch()
    {
        $package = [];
        $defaultParams = ['typeFilters' => []];
        $searchParams = array_merge($defaultParams, $_GET);

        if (empty($searchParams['term'])) {
            Yii::$app->response->data = $package;
            return;
        }

        if (isset($searchParams['modules']) && !is_array($searchParams['modules'])) {
            $searchParams['modules'] = implode(',', $searchParams['modules']);
        }

        $modules = isset($searchParams['modules']) ? (array) $searchParams['modules'] : array_keys(Yii::$app->collectors['types']->getAll());
        $params = ['ignore' => [], 'ignoreChildren' => [], 'ignoreParents' => []];
        if (!empty($searchParams['ignore'])) {
            $params['ignore'] = (array) $searchParams['ignore'];
        }
        if (!empty($searchParams['ignoreChildren'])) {
            $params['ignoreChildren'] = (array) $searchParams['ignoreChildren'];
        }
        if (!empty($searchParams['ignoreParents'])) {
            $params['ignoreParents'] = (array) $searchParams['ignoreParents'];
        }
        $params['action'] = 'read';
        $params['modules'] = $modules;
        $term = $searchParams['term'];
        $params['limit'] = 8;
        $scores = [];
        foreach ($modules as $module) {
            $moduleItem = Yii::$app->collectors['types']->getOne($module);
            if (!$moduleItem || !($moduleObject = $moduleItem->object)) {
                continue;
            }
            if (!(isset($searchParams['modules']) && in_array($moduleItem->systemId, $searchParams['modules'])) && empty($moduleItem->object->searchWeight)) {
                continue;
            }
            if (in_array('authority', $searchParams['typeFilters']) && $moduleItem->object->getBehavior('Authority') === null) {
                continue;
            }
            if (in_array('dashboard', $searchParams['typeFilters']) && !$moduleItem->object->hasDashboard) {
                continue;
            }
            $moduleResults = $moduleObject->search($term, $params);
            foreach ($moduleResults as $r) {
                $package[] = $r;
            }
        }
        ArrayHelper::multisort($package, 'scoreSort', SORT_DESC);
        foreach (array_slice($package, 0, 30) as $key => $result) {
            $package[$key] = $result->toArray();
        }
        Yii::$app->response->data = $package;
    }
public function actionSearch ( ) { $ package = [ ] ; $ defaultParams = [ 'typeFilters' => [ ] ] ; $ searchParams = array_merge ( $ defaultParams , $ _GET ) ; if ( empty ( $ searchParams [ 'term' ] ) ) { Yii :: $ app -> response -> data = $ package ; return ; } if ( isset ( $ searchParams [ 'modules' ] ) && ! is_array ( $ searchParams [ 'modules' ] ) ) { $ searchParams [ 'modules' ] = implode ( ',' , $ searchParams [ 'modules' ] ) ; } $ modules = isset ( $ searchParams [ 'modules' ] ) ? ( array ) $ searchParams [ 'modules' ] : array_keys ( Yii :: $ app -> collectors [ 'types' ] -> getAll ( ) ) ; $ params = [ 'ignore' => [ ] , 'ignoreChildren' => [ ] , 'ignoreParents' => [ ] ] ; if ( ! empty ( $ searchParams [ 'ignore' ] ) ) { $ params [ 'ignore' ] = ( array ) $ searchParams [ 'ignore' ] ; } if ( ! empty ( $ searchParams [ 'ignoreChildren' ] ) ) { $ params [ 'ignoreChildren' ] = ( array ) $ searchParams [ 'ignoreChildren' ] ; } if ( ! empty ( $ searchParams [ 'ignoreParents' ] ) ) { $ params [ 'ignoreParents' ] = ( array ) $ searchParams [ 'ignoreParents' ] ; } $ params [ 'action' ] = 'read' ; $ params [ 'modules' ] = $ modules ; $ term = $ searchParams [ 'term' ] ; $ params [ 'limit' ] = 8 ; $ scores = [ ] ; foreach ( $ modules as $ module ) { $ moduleItem = Yii :: $ app -> collectors [ 'types' ] -> getOne ( $ module ) ; if ( ! $ moduleItem || ! ( $ moduleObject = $ moduleItem -> object ) ) { continue ; } if ( ! ( isset ( $ searchParams [ 'modules' ] ) && in_array ( $ moduleItem -> systemId , $ searchParams [ 'modules' ] ) ) && empty ( $ moduleItem -> object -> searchWeight ) ) { continue ; } if ( in_array ( 'authority' , $ searchParams [ 'typeFilters' ] ) && $ moduleItem -> object -> getBehavior ( 'Authority' ) === null ) { continue ; } if ( in_array ( 'dashboard' , $ searchParams [ 'typeFilters' ] ) && ! $ moduleItem -> object -> hasDashboard ) { continue ; } $ moduleResults = $ moduleObject -> search ( $ term , $ params ) ; foreach ( $ moduleResults as $ r ) { $ package [ ] = $ r ; } } ArrayHelper :: multisort ( $ package , 'scoreSort' , SORT_DESC ) ; foreach ( array_slice ( $ package , 0 , 30 ) as $ key => $ result ) { $ package [ $ key ] = $ result -> toArray ( ) ; } Yii :: $ app -> response -> data = $ package ; }
[[@doctodo method_description:actionSearch]].

@return [[@doctodo return_type:actionSearch]] [[@doctodo return_description:actionSearch]]
[[ @doctodo method_description : actionSearch ]] .