Build Scaffolding Index page query.

@return mixed
324323
public function getQuery()
    {
        // prevent duplicated execution
        if (null === $this->query && $this->model) {
            $this->initQuery()
                 ->applyFilters()
                 ->applySorting();

            $this->query = $this->assembler()->getQuery();
        }

        return $this->query;
    }
64354
public function actionIndex()
    {
        $searchModel = Yii::createObject(AuthenticationSearch::className());
        $dataProvider = $searchModel->search(Yii::$app->request->get());

        return $this->render('index', [
            'searchModel' => $searchModel,
            'dataProvider' => $dataProvider,
        ]);
    }
822333
public function indexAction()
    {
        $em = $this->getDoctrine()->getManager();

        $pages = $em->getRepository('CoreBundle:Page')->findAll();

        return array(
            'pages' => $pages,
        );
    }
317882
public function actionIndex()
    {
        /* @var AssignmentSearch */
        $searchModel = Yii::createObject($this->searchClass);

        if ($searchModel instanceof AssignmentSearch) {
            $dataProvider = $searchModel->search(Yii::$app->request->queryParams, $this->userIdentityClass, $this->idField, $this->usernameField);
        } else {
            $dataProvider = $searchModel->search(Yii::$app->request->queryParams);
        }

        return $this->render('index', [
            'dataProvider' => $dataProvider,
            'searchModel' => $searchModel,
            'gridViewColumns' => $this->gridViewColumns,
        ]);
    }
374323
protected function buildQuery()
	{
		$this->setup();

		$query = array();

		// Index always needs to be provided. _all means a cross index search.
		$query['index'] = empty($this->indices) ? '_all' : implode(',', array_values($this->indices));

		// Type is not required, will search in the entire index.
		if (!empty($this->types)) {
			$query['type'] = implode(',', array_values($this->types));
		}

		// Replace Fragments with their raw body.
		$query['body'] = $this->fragmentParser->parse($this->body);

		// Add all query string params, the SDK will only add known params to the URL.
		foreach ($this->queryStringParams as $paramName => $paramValue) {
			$query[$paramName] = $paramValue;
		}

		return $query;
	}
380961
public function findIndexable()
    {
        return $this->createQueryBuilder('c')
            ->where('c.indexable = :indexable')
            ->Andwhere('c.active = :active')
            ->Andwhere('c.layout = :layout')
            ->setParameters([
                'active' => true,
                'layout' => false,
                'indexable' => true
            ])
            ->orderBy('c.slug', 'ASC')
            ->getQuery()
            ->getResult();
    }
999304
public function indexesAction()
    {
        return $this->viewHandler->handle(
            View::create(
                array_map(
                    function($indexName) {
                        $indexConfiguration = $this->indexConfigurationProvider->getIndexConfiguration($indexName);

                        return $indexConfiguration ?: new IndexConfiguration($indexName);
                    },
                    $this->getAllowedIndexes()
                )
            )
        );
    }
577653
public function index()
    {
        $model = new Model();
        $pageOptions = Page::Options();
        $countryOptions = Country::options();

        return view('avored-framework::system.configuration.index')
            ->withModel($model)
            ->withPageOptions($pageOptions)
            ->withCountryOptions($countryOptions);
    }
307187
public function startIndexing()
    {

        // get all address records from pid set in indexerConfig
        $fields = '*';
        $table = 'tt_address';
        $indexPids = $this->getPidList(
            $this->indexerConfig['startingpoints_recursive'],
            $this->indexerConfig['sysfolder'],
            $table
        );

        if ($this->indexerConfig['index_use_page_tags']) {
            // add the tags of each page to the global page array
            $this->pageRecords = $this->getPageRecords($indexPids);
            $this->addTagsToRecords($indexPids);
        }

        $queryBuilder = Db::getQueryBuilder($table);

        $result = $queryBuilder
            ->select($fields)
            ->from($table)
            ->where(
                $queryBuilder->expr()->in(
                    'pid',
                    $queryBuilder->createNamedParameter(
                        implode(',', $indexPids), \PDO::PARAM_STR
                    )
                )
            )
            ->execute()
            ->fetchAll();

        // no address records found
        if (!count($result)) {
            $content = '<p>No address records found!</p>';
            return $content;
        } else {
            foreach ($result as $addressRow) {

                $abstract = '';
                $content = '';

                // set title, use company if set, otherwise name
                $title = !empty($addressRow['company'])
                    ? $addressRow['company'] :
                    (!empty($addressRow['name']) ? $addressRow['name']
                        : ($addressRow['first_name'] . ' ' . $addressRow['last_name']));

                // use description as abstract if set
                if (!empty($addressRow['description'])) {
                    $abstract = $addressRow['description'];
                }

                // build content
                if (!empty($addressRow['company'])) {
                    $content .= $addressRow['company'] . "\n";
                }
                if (!empty($addressRow['title'])) {
                    $content .= $addressRow['title'] . ' ';
                }
                if (!empty($addressRow['name'])) {
                    $content .= $addressRow['name'] . "\n"; // name
                } else {
                    if (!empty($addressRow['first_name'])) {
                        $content .= $addressRow['first_name'] . ' ';
                    }
                    if (!empty($addressRow['middle_name'])) {
                        $content .= $addressRow['middle_name'] . ' ';
                    }
                    if (!empty($addressRow['last_name'])) {
                        $content .= $addressRow['last_name'] . ' ';
                    }
                    if (!empty($addressRow['last_name'])
                        || !empty($addressRow['middle_name'])
                        || !empty($addressRow['middle_name'])) {
                        $content .= "\n";
                    }
                }
                if (!empty($addressRow['address'])) {
                    $content .= $addressRow['address'] . "\n";
                }
                if (!empty($addressRow['zip'])) {
                    $content .= $addressRow['zip'] . "\n";
                }
                if (!empty($addressRow['city'])) {
                    $content .= $addressRow['city'] . "\n";
                }
                if (!empty($addressRow['country'])) {
                    $content .= $addressRow['country'] . "\n";
                }
                if (!empty($addressRow['region'])) {
                    $content .= $addressRow['region'] . "\n";
                }
                if (!empty($addressRow['email'])) {
                    $content .= $addressRow['email'] . "\n";
                }
                if (!empty($addressRow['phone'])) {
                    $content .= $addressRow['phone'] . "\n";
                }
                if (!empty($addressRow['fax'])) {
                    $content .= $addressRow['fax'] . "\n";
                }
                if (!empty($addressRow['mobile'])) {
                    $content .= $addressRow['mobile'] . "\n";
                }
                if (!empty($addressRow['www'])) {
                    $content .= $addressRow['www'];
                }

                // put content together
                $fullContent = $abstract . "\n" . $content;

                // there is no tt_address default param like this; you have to modify this by hook to fit your needs
                $params = '&tt_address[showUid]=' . $addressRow['uid'];

                // no tags yet
                if ($this->indexerConfig['index_use_page_tags']) {
                    $tagContent = $this->pageRecords[intval($addressRow['pid'])]['tags'];
                } else {
                    $tagContent = '';
                }

                // set additional fields for sorting
                $additionalFields = array(
                    'sortdate' => $addressRow['tstamp'],
                );

                // fill orig_uid
                if (isset($addressRow['uid']) && $addressRow['uid'] > 0) {
                    $additionalFields['orig_uid'] = $addressRow['uid'];
                }

                // fill orig_pid
                if (isset($addressRow['pid']) && $addressRow['pid'] > 0) {
                    $additionalFields['orig_pid'] = $addressRow['pid'];
                }

                // make it possible to modify the indexerConfig via hook
                $indexerConfig = $this->indexerConfig;

                // add some fields which you may set in your own hook
                $customfields = array(
                    'sys_language_uid' => 0,
                    'starttime' => 0,
                    'endtime' => 0,
                    'fe_group' => ''
                );

                // hook for custom modifications of the indexed data, e. g. the tags
                if (is_array($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['ke_search']['modifyAddressIndexEntry'])) {
                    foreach ($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['ke_search']['modifyAddressIndexEntry'] as $_classRef) {
                        $_procObj = &GeneralUtility::makeInstance($_classRef);
                        $_procObj->modifyAddressIndexEntry(
                            $title,
                            $abstract,
                            $fullContent,
                            $params,
                            $tagContent,
                            $addressRow,
                            $additionalFields,
                            $indexerConfig,
                            $customfields
                        );
                    }
                }

                // store in index
                $this->pObj->storeInIndex(
                    $indexerConfig['storagepid'],       // storage PID
                    $title,                             // page/record title
                    'tt_address',                       // content type
                    $indexerConfig['targetpid'],        // target PID: where is the single view?
                    $fullContent,                       // indexed content, includes the title (linebreak after title)
                    $tagContent,                        // tags
                    $params,                            // typolink params for singleview
                    $abstract,                          // abstract
                    $customfields['sys_language_uid'],  // language uid
                    $customfields['starttime'],         // starttime
                    $customfields['endtime'],           // endtime
                    $customfields['fe_group'],          // fe_group
                    false,                              // debug only?
                    $additionalFields                   // additional fields added by hooks
                );

            }
        }

        $content = '<p><b>Indexer "'
            . $this->indexerConfig['title']
            . '": '
            . count($result)
            . ' address records have been indexed.</b></p>'
            . "\n";

        $content .= $this->showErrors();
        $content .= $this->showTime();

        return $content;
    }
407929
public function buildIndex()
    {
        $this->file->flock(LOCK_SH);
        $this->file->fseek(0);

        $indexes = [];
        while (!$this->file->eof()) {
            $position = $this->file->ftell();

            // Grab key and value lengths - if its the last (empty) line, break
            if (!$metadata = $this->getMetadata()) {
                break;
            }

            // Gets the key and adds the key and position to the index
            $indexes[$this->file->fread($metadata->klen)] = $position;

            //Skip over the value, to the next key/value pair
            $this->file->fseek($metadata->vlen, SEEK_CUR);
        }
        $this->file->flock(LOCK_UN);

        return $indexes;
    }
175412
public function indexBuilder()
    {
        if ($this->relationships == 0) {
            return '$' . strtolower($this->modelName) . ' = ' . $this->modelName . '::all();';
        } else {
            $relationship = '$' . strtolower($this->modelName) . ' = ' . $this->modelName . '::$WITH$get();';
            foreach ($this->fields as $field) {
                if ($field->type == 'relationship') {
                    $relationship = str_replace([
                        '$WITH$'
                    ], [
                        'with("' . $field->relationship_name . '")->$WITH$'
                    ], $relationship);
                }
            }
            $relationship = str_replace('$WITH$', '', $relationship);

            return $relationship;
        }
    }
211098
public function getQuery()
    {
        $joins = empty($this->joins) ? '' : implode(' ', $this->joins);
        $where = empty($this->where) ? '' : 'WHERE '.implode(' AND ', $this->where);
        $sort = empty($this->sortBy) ? '' : 'ORDER BY '.implode(', ', $this->sortBy);
        $limit = is_null($this->page) ? '' : 'LIMIT ' . $this->page .',' .$this->length;
        $group = empty($this->group) ? '' : 'GROUP BY ' . implode(', ', $this->group);
        
        $query = sprintf(
            'SELECT %s FROM %s %s %s %s %s %s;',
            $this->select,
            $this->from,
            $joins,
            $where,
            $group,
            $sort,
            $limit
        );
        
        return str_replace('  ', ' ', $query);
    }
291158
public function toUrlQuery()
    {
        $queryData = array();
        foreach (self::$properties as $p => $setter) {
            if ($this->$p !== null) {
                $queryData[$p] = $this->$p;
            }
        }
        return http_build_query($queryData);
    }
155961
public function getIndex()
    {
        $this->di->get("auth")->isAdmin(true);

        $user = new User();
        $user->setDb($this->di->get("db"));

        $title      = "Min sida";
        $view       = $this->di->get("view");
        $pageRender = $this->di->get("pageRender");


        $data = [
            "title" => $title,
            "users" => $user->findAll(),
        ];

        $view->add("admin/index", $data);

        $pageRender->renderPage(["title" => $title]);
    }
142016
public function index()
    {
        return $this->render('index', [
            'pages' => $this->model->getNavItemPageBlockItems()->select(['nav_item_page_id'])->distinct()->orderBy([])->all(),
        ]);
    }
987052
public function indexAction()
    {
        $page = $this->getEvent()
            ->getRouteMatch()
            ->getParam('page');

        $revision = $this->getEvent()
            ->getRouteMatch()
            ->getParam('revision', null);

        return $this->getCmsResponse(
            $this->currentSite,
            $page,
            $revision
        );
    }
458353
public function index()
    {
        $apiRequest = RequestFactory::create();

        $page = $apiRequest->getPage();
        if (!$page->size()) {
            $page->setSize($this->pageSize);
        }

        $fields = $apiRequest->getFields();
        $sorting = $apiRequest->getSort();
        $included = $apiRequest->getIncludedRelationships();
        $filters = $apiRequest->getFilters();

        $resource = new ListResource($this->serializer, $page, $fields, $sorting, $included, $filters);

        $totalAmount = $this->totalAmountResourceCallable();
        $results = $this->listResourceCallable();

        $controllerAction = '\\'.get_called_class().'@index';
        $uri = $this->uriGenerator($controllerAction);

        return $this->addHeaders($resource->get($totalAmount, $results, $uri, get_class($this->getDataModel())));
    }