Retrieve the search suggestions that have been approved (great for client side filtering).

@URLparameter page <{EXTENSIBLE_SEARCH_PAGE_ID}> integer
@return JSON
352780
public function getPageSuggestions($request) {

		if(Config::inst()->get(ExtensibleSearchSuggestion::class, 'enable_suggestions')) {
			$suggestions = $this->service->getPageSuggestions($request->getVar('page'));

			// Return the search suggestions as JSON.

			$this->getResponse()->addHeader('Content-Type', 'application/json');

			// JSON_PRETTY_PRINT.

			return json_encode($suggestions, 128);
		}
		else {
			return $this->httpError(404);
		}
	}
76177
public function getList()
    {
        $siteId = $this->getRequestSiteId();

        //ACCESS CHECK
        $sitePagesResource = $this->getSitePagesResourceId($siteId);
        if (!$this->isAllowed('pages', 'read')
            && !$this->isAllowed(
                $sitePagesResource,
                'read'
            )
        ) {
            $this->getResponse()->setStatusCode(Response::STATUS_CODE_401);

            return $this->getResponse();
        }

        $site = $this->getSite($siteId);

        if (empty($site)) {
            return new ApiJsonModel(
                null,
                1,
                "Site was not found with id {$siteId}."
            );
        }

        $pages = $site->getPages();

        foreach ($pages as $key => $page) {
            $apiResponse = new SitePageApiResponse($page);

            $pages[$key] = $apiResponse;
        }

        return new ApiJsonModel(
            $pages,
            0,
            'Success'
        );
    }
926652
public function search()
    {
        if($this->request->isAjax())
        {
            $data = $this->doc->searchList($this->request->param('query'));
            return response($data, 200, [], 'json');
        }
        else
        {
            $module = $this->doc->getModuleList();
            return $this->show('search', ['module' => $module]);
        }
    }
159796
public function getSearchCatId()
    {
        if ($this->_sSearchCatId === null) {
            $this->_sSearchCatId = false;
            if ($this->_isSearchClass()) {
                $this->_sSearchCatId = rawurldecode(\OxidEsales\Eshop\Core\Registry::getConfig()->getRequestParameter('searchcnid'));
            }
        }

        return $this->_sSearchCatId;
    }
1294124
public function getSuggestions(SearchRequest $searchRequest, array $additionalFilters = []) : array
    {
        $requestId = (int)$this->tsfe->getRequestedId();
        $groupList = (string)$this->tsfe->gr_list;

        $suggestQuery = $this->queryBuilder->buildSuggestQuery($searchRequest->getRawUserQuery(), $additionalFilters, $requestId, $groupList);
        $solrSuggestions = $this->getSolrSuggestions($suggestQuery);

        if ($solrSuggestions === []) {
            return ['status' => false];
        }

        $maxSuggestions = $this->typoScriptConfiguration->getSuggestNumberOfSuggestions();
        $showTopResults = $this->typoScriptConfiguration->getSuggestShowTopResults();
        $suggestions    = $this->getSuggestionArray($suggestQuery, $solrSuggestions, $maxSuggestions);

        if (!$showTopResults) {
            return $this->getResultArray($searchRequest, $suggestions, [], false);
        }

        return $this->addTopResultsToSuggestions($searchRequest, $suggestions, $additionalFilters);
    }
666981
private function getRecommendation()
    {
        $recommendation = [];
        $recommendation_area = $this->_type == 'anime' ? $this->_parser->find('#anime_recommendation', 0) : $this->_parser->find('#manga_recommendation', 0);
        if ($recommendation_area) {
            foreach ($recommendation_area->find('li.btn-anime') as $each_recom) {
                $tmp = [];

                $tmp['id'] = $this->getRecomId($each_recom);
                $tmp['title'] = $this->getRecomTitle($each_recom);
                $tmp['image'] = $this->getRecomImage($each_recom);
                $tmp['user'] = $this->getRecomUser($each_recom);

                $recommendation[] = $tmp;
            }
        }

        return $recommendation;
    }
1268247
public function getRequestParameters()
    {
        // $page current page of the grid
        $page = (int) $this->getRequest()->get('page', 0);
        
        // $orderBy column name to sort datagrid records
        $orderBy = $this->getRequest()->get('sidx', false);
        
        // ASC | DESC $sort
        $sort = strtoupper($this->getRequest()->get('sord', 'asc'));
        
        // $records  number of records to display
        $records = (int) $this->getRequest()->get('rows', 0);
        
        // $search is search in the query
        $search = ($this->getRequest()->get('_search', false) === 'true');
 
        // $filters Filters from the search query
        $filters = (array) json_decode($this->getRequest()->get('filters', '{}'));
        
        // $masterRowId Id of the master grid record
        $masterGridRowId = (int) $this->getRequest()->get('masterGridRowId', 0);
        
        $parameters = array(
            'page'            => $page,
            'orderBy'         => $orderBy,
            'sort'            => $sort,
            'records'         => $records,
            'search'          => $search,
            'filters'         => $filters,
            'masterGridRowId' => $masterGridRowId
        );
        
        return $parameters;
    }
1140527
public function getSearchDefaults()
    {
        $data = parent::getSearchDefaults();

        if (! isset($data[\MUtil_Model::REQUEST_ID])) {
            $data[\MUtil_Model::REQUEST_ID] = intval($this->_getIdParam());
        }

        return $data;
    }
964967
protected static function getParams()
    {
        $adapter  = app(FilterAdapter::class)->add(ActivityTypeWidgetFilter::class);
        $request  = app('request');
        $priority = $request->get('priority');
        $search   = $request->get('search');
        $logs     = self::filter($priority, $search);
        return [
            'select_url'        => self::getBaseUrl(['page' => 1, 'per_page' => self::perPage, 'search' => '']),
            'search_url'        => self::getBaseUrl(['page' => 1, 'per_page' => self::perPage, 'priority' => null]),
            'url'               => self::getBaseUrl(),
            'selected_priority' => $priority,
            'search'            => $search,
            'types'             => app(LogTypes::class)->all(),
            'logs'              => $logs,
            'pagination'        => $logs->links('antares/foundation::layouts.antares.partials.pagination._pagination'),
            'priorites'         => app(LogPriorities::class)->all(),
            'filters'           => $adapter->getFilters('antares/logger::admin.widgets.log_filter')
        ];
    }
804888
public function GetSearchRestrictionLink()
    {
        // get current search... then add filter
        $oShop = $this->getShopService()->getActiveShop();
        $oSearchCache = &$oShop->GetActiveSearchObject();
        //$oSearchCache->aFilter[TdbShopCategory::FILTER_KEY_NAME] = $this->id;
        return $oSearchCache->GetSearchLink(array(TdbShopCategory::FILTER_KEY_NAME => $this->id));
    }
510763
protected function getSearchResults()
    {
        $callback = $this->getSearchFunction();
        if ($callback) {
            return call_user_func($callback, $this->getSourceObject(), $this->getLabelField(), $this->search);
        }

        $sourceObject = $this->getSourceObject();
        $filters = array();
        $sourceObjectInstance = DataObject::singleton($sourceObject);
        $candidates = array_unique([
            $this->getLabelField(),
            $this->getTitleField(),
            'Title',
            'Name'
        ]);
        foreach ($candidates as $candidate) {
            if ($sourceObjectInstance->hasDatabaseField($candidate)) {
                $filters["{$candidate}:PartialMatch"] = $this->search;
            }
        }

        if (empty($filters)) {
            throw new InvalidArgumentException(sprintf(
                'Cannot query by %s.%s, not a valid database column',
                $sourceObject,
                $this->getTitleField()
            ));
        }
        return DataObject::get($this->getSourceObject())->filterAny($filters);
    }
1257684
function suggestions_may_interested( $page = 1, $count = 10 )
	{   
		$params = array();
		$params['page'] = $page;
		$params['count'] = $count;
		return $this->oauth->get( 'suggestions/users/may_interested', $params);
	}
1240777
public function do_search()
    {
        $query = (string) $this->request->request('query');

        $ipl = new PageList();
        $aksearch = false;
        $akIDs = $this->request->request('akID');
        if (is_array($akIDs)) {
            foreach ($akIDs as $akID => $req) {
                $fak = CollectionAttributeKey::getByID($akID);
                if (is_object($fak)) {
                    $type = $fak->getAttributeType();
                    $cnt = $type->getController();
                    $cnt->setAttributeKey($fak);
                    $cnt->searchForm($ipl);
                    $aksearch = true;
                }
            }
        }

        if ($this->request->request('month') !== null && $this->request->request('year') !== null) {
            $year = @(int) ($this->request->request('year'));
            $month = abs(@(int) ($this->request->request('month')));
            if (strlen(abs($year)) < 4) {
                $year = (($year < 0) ? '-' : '') . str_pad(abs($year), 4, '0', STR_PAD_LEFT);
            }
            if ($month < 12) {
                $month = str_pad($month, 2, '0', STR_PAD_LEFT);
            }
            $daysInMonth = date('t', strtotime("$year-$month-01"));
            $dh = Core::make('helper/date');
            /* @var $dh \Concrete\Core\Localization\Service\Date */
            $start = $dh->toDB("$year-$month-01 00:00:00", 'user');
            $end = $dh->toDB("$year-$month-$daysInMonth 23:59:59", 'user');
            $ipl->filterByPublicDate($start, '>=');
            $ipl->filterByPublicDate($end, '<=');
            $aksearch = true;
        }

        if ($query === '' && $aksearch === false) {
            return false;
        }

        if ($query !== '') {
            $ipl->filterByKeywords($query);
        }

        $search_paths = $this->request->request('search_paths');
        if (is_array($search_paths)) {
            foreach ($search_paths as $path) {
                if ($path === '') {
                    continue;
                }
                $ipl->filterByPath($path);
            }
        } elseif ($this->baseSearchPath != '') {
            $ipl->filterByPath($this->baseSearchPath);
        }

        $cak = CollectionKey::getByHandle('exclude_search_index');
        if (is_object($cak)) {
            $ipl->filterByExcludeSearchIndex(false);
        }

        $pagination = $ipl->getPagination();
        $results = $pagination->getCurrentPageResults();

        $this->set('query', $query);
        $this->set('results', $results);
        $this->set('do_search', true);
        $this->set('searchList', $ipl);
        $this->set('pagination', $pagination);
    }
981126
private function getSearchResult(array $filters, $limit, $page, $pageSize, $locale, $webspaceKey)
    {
        $repository = $this->searchManager->getRepository($this->articleDocumentClass);
        $search = $this->createSearch($repository->createSearch(), $filters, $locale);
        if (!$search) {
            return new \ArrayIterator([]);
        }

        $this->addPagination($search, $pageSize, $page, $limit);

        if (array_key_exists('sortBy', $filters) && is_array($filters['sortBy'])) {
            $sortMethod = array_key_exists('sortMethod', $filters) ? $filters['sortMethod'] : 'asc';
            $this->appendSortBy($filters['sortBy'], $sortMethod, $search);
        }

        if ($webspaceKey) {
            $webspaceQuery = new BoolQuery();

            // check for mainWebspace
            $webspaceQuery->add(new TermQuery('main_webspace', $webspaceKey), BoolQuery::SHOULD);

            // check for additionalWebspaces
            $webspaceQuery->add(new TermQuery('additional_webspaces', $webspaceKey), BoolQuery::SHOULD);

            $search->addQuery($webspaceQuery);
        }

        return $repository->findDocuments($search);
    }
510300
public function getFiltered($page, $numRows, $sortAttr, $sortOrder, $searchAttr, $searchValue, $richFilters = [])
    {
        $query = $this->prepareQuery();

        $query = $this->richFiltersOnQuery($query, $richFilters);

        if ($sortAttr && $sortOrder && $this->inScope($sortAttr)) {
            $scope = $this->getScope($sortAttr);
            $query = $query->orderBy($scope, $sortOrder);
        }

        if ($searchAttr && $searchValue && $this->inScope($searchAttr)) {
            $scope = $this->getScope($searchAttr);
            $query = $query->where($scope, 'like', '%' . $searchValue . '%');
        }

        $collection = $query->get();

        $collection = $this->addPermissions($collection);

        $collection = $this->formatCollection($collection);

        $collection = $collection->each(function ($model) {
            $model = $this->formatModel($model);
        });

        if ($sortAttr && $sortOrder && ! $this->inScope($sortAttr)) {
            $collection = $sortOrder == 'asc'
                ? $collection->sortBy($sortAttr)
                : $collection->sortByDesc($sortAttr);
        }

        $collection = $this->richFiltersOnCollection($collection, $richFilters);

        if ($searchAttr && $searchValue && ! $this->inScope($searchAttr)) {
            $collection = $collection->filter(function ($model) use ($searchAttr, $searchValue) {
                $value = (string) $model->$searchAttr;
                $value = strtolower($value);
                $search = strtolower($searchValue);
                return strpos($value, $search) !== false;
            });
        }

        if ($page && $numRows) {
            $toSkip = ($page - 1) * $numRows;
            $count = $collection->count();
            $collection = $collection->take(- ($count - $toSkip))->take($numRows);
        } else if ($numRows)
            $collection = $collection->take($numRows);

        return collect(array_values($collection->toArray()));
    }
1119453
public function getPageForApproved( $config = [] ) {

		$modelTable	= $this->getModelTable();
		$topLevel	= isset( $config[ 'topLevel' ] ) ? $config[ 'topLevel' ] : true;

		if( $topLevel ) {

			$config[ 'conditions' ][ 'baseId' ] = null;
		}

		$config[ 'conditions' ][ "$modelTable.status" ]	= ModelComment::STATUS_APPROVED;

		return $this->getPage( $config );
	}
641401
public function getNextPageParams()
    {
        $limit = $this->limit <= 0 ? $this->count : $this->limit;
        $next_url = $this->offset_key
            . $this->offset
            . $this->limit_key
            . $limit;

        if ($this->count <= ($this->offset + $limit)) {
           return false;
        }

        if ($this->count >= $limit) {
            $next_url = $this->offset_key
                . ($this->offset + $limit)
                . $this->limit_key
                . $limit;
        }

        return $next_url;
    }