Re-indexes the related indices for the given ActiveQueryInterface.
The result of the given ActiveQuery must consist from Searchable models of the same class.

@param ActiveQueryInterface $activeQuery

@return array
505806
public function reindexByActiveQuery(ActiveQueryInterface $activeQuery)
    {
        $indices = null;
        $records = $this->activeQueryChunker->chunk(
            $activeQuery,
            self::CHUNK_SIZE,
            function ($activeRecordEntities) use (&$indices) {
                $records = $this->getAlgoliaRecordsFromSearchableModelArray($activeRecordEntities);

                // The converting ActiveRecords to Algolia ones already does the type checking
                // so it's safe to init indices here during the first chunk.
                if ($indices === null) {
                    $indices = $this->initIndices($activeRecordEntities[0]);
                }

                return $records;
            }
        );

        return $this->processIndices($indices, function (Index $index) use ($records) {
            return $this->reindexAtomically($index, $records);
        });
    }
150443
public function getAllAsArray($query = null)
    {
        return [
            'unchangedCount' => $this->getUnchangedCount($query),
            'changedCount' => $this->getChangedCount($query),
            'failedCount' => $this->getFailedCount($query),
            'nodesCount' => $this->getNodesCount($query),
            'nodesCountByOS' => $this->getNodesCountByOS($query),
            'nodesPercentageByOS' => $this->getNodesPercentageByOS($query),
            'osCount' => $this->getOSCount($query),
            'recentlyRebootedNodes' => $this->getRecentlyRebootedNodes($query),
        ];
    }
327317
public function addConditions(\yii\db\ActiveQuery $query)
    {
        if ($query instanceof ActiveQuery) {
            $this->addQuickSearchConditions($query);
        }
        $this->validate();
        $this->addAttributesSearchConditions($query);
        return $query;
    }
337541
public function &GetActiveSearchObject()
    {
        if (is_null($this->oActiveSearchCache) && array_key_exists(self::SESSION_ACTIVE_SEARCH_CACHE_ID, $_SESSION)) {
            $this->oActiveSearchCache = unserialize(base64_decode($_SESSION[self::SESSION_ACTIVE_SEARCH_CACHE_ID]));
            //        $this->oActiveSearchCache = TdbShopSearchCache::GetNewInstance();
            //        if (!$this->oActiveSearchCache->Load($_SESSION[self::SESSION_ACTIVE_SEARCH_CACHE_ID])) $this->oActiveSearchCache = null;
        }

        return $this->oActiveSearchCache;
    }
702424
protected function getQueryResults(array $models) {
        if (empty($this->relations)) {
            return static::getRelationQuery($models)->all();
        }
        $data = static::getRelationQuery($models)->appendSelect($this->getRelationFields())->all();
        if (empty($data)) {
            return $data;
        }
        foreach ($this->relations as $relation) {
            if (empty($relation->getKey())) {
                return $relation->getResults($data);
            }
            $data = $relation->getResults($data);
        }
        return $data;
    }
600373
public function search($query)
    {
        $this->validate($query);
        $client = $this->client->getClient();
        $result = array();
        // Change the match column name with the column name you want to search in it.
        $params = [
                'index' => $this->client->getIndex(),
                'type'  => $this->client->getType(),
                'body'  => [
                    'query' => [
                        'match' => [ $this->searchColumn => $query],
                    ],
                ],
            ];
        $query  = $client->search($params);
            
        return  $this->extractResult($query);
    }
759908
public function loadIndexedList()
    {
        if ($this->stmt === null) {
            return null;
        }

        $indexedList = array();
        while ($row = $this->stmt->fetch(\PDO::FETCH_NUM)) {
            $indexedList[] = $row;
        }
        return $indexedList;
    }
811407
public static function getDropDownItems($query)
    {
        if ($query instanceof ActiveQuery) {
            $query->defaultOrder();
        }

        /** @var \yii\db\ActiveRecord|\netis\rbac\AuthorizerBehavior $model */
        $model = new $query->modelClass;

        $fields = $model::primaryKey();
        if (($labelAttributes = $model->getBehavior('labels')->attributes) !== null) {
            $fields = array_merge($model::primaryKey(), $labelAttributes);
        }

        $flippedPrimaryKey = array_flip($model::primaryKey());
        return ArrayHelper::map(
            $query->from($model::tableName() . ' t')->all(),
            function ($item) use ($fields, $flippedPrimaryKey) {
                /** @var \netis\crud\db\ActiveRecord $item */
                return Action::exportKey(array_intersect_key($item->toArray($fields, []), $flippedPrimaryKey));
            },
            function ($item) use ($fields) {
                /** @var \netis\crud\db\ActiveRecord $item */
                $data = $item->toArray($fields, []);
                return $data['_label'];
            }
        );
    }
314462
public function getIndexEngineIndex(ConnectionInterface $con = null)
    {
        if ($this->aIndexEngineIndex === null && ($this->id !== null)) {
            $this->aIndexEngineIndex = ChildIndexEngineIndexQuery::create()->findPk($this->id, $con);
            /* The following can be used additionally to
                guarantee the related object contains a reference
                to this object.  This level of coupling may, however, be
                undesirable since it could result in an only partially populated collection
                in the referenced object.
                $this->aIndexEngineIndex->addIndexEngineIndexVersions($this);
             */
        }

        return $this->aIndexEngineIndex;
    }
627505
public function updateInIndices(SearchableInterface $searchableModel)
    {
        $indices = $this->initIndices($searchableModel);
        $record = $searchableModel->getAlgoliaRecord();
        $record['objectID'] = $searchableModel->getObjectID();

        return $this->processIndices($indices, function (Index $index) use ($record) {
            return $index->saveObject($record);
        });
    }
1300059
private function applyFilters(array $query) : array
    {
        $documentPersister = $this->dm->getUnitOfWork()->getDocumentPersister($this->class->name);

        $query = $documentPersister->addDiscriminatorToPreparedQuery($query);
        $query = $documentPersister->addFilterToPreparedQuery($query);

        return $query;
    }
1044372
public function search($query) {
        $result = array();
        foreach ($this->get_children() as $child) {
            $subsearch = $child->search($query);
            if (!is_array($subsearch)) {
                debugging('Incorrect search result from '.$child->name);
                continue;
            }
            $result = array_merge($result, $subsearch);
        }
        return $result;
    }
17746
public function search($query)
    {
        $searchProviders = [];

        foreach ($this->searchProviders as $searchProvider) {
            if (!$searchProvider instanceof SearchProviderInterface) {
                continue;
            }

            $role = $searchProvider->getRole();
            if ($role && !$this->authorizationChecker->isGranted($role)) {
                continue;
            }

            $searchProviders[] = $searchProvider;
        }

        $explodedQuery = explode(':', $query);
        if (count($explodedQuery) > 1) {
            $keySearchProviders = [];
            $keyWord = strtolower(array_shift($explodedQuery));

            foreach ($searchProviders as $searchProvider) {
                $searchKey = $searchProvider->getSearchKey();
                if ($searchKey === $keyWord) {
                    $keySearchProviders[] = $searchProvider;
                }
            }

            if (count($keySearchProviders)) {
                $searchProviders = $keySearchProviders;
                $query = trim(implode(':', $explodedQuery));
            }
        }

        $results = [];
        foreach ($searchProviders as $searchProvider) {
            $searchResults = $searchProvider->search($query);
            foreach ($searchResults as $searchResult) {
                $results[] = $searchResult->toArray();
            }
        }

        return $results;
    }
961837
public static function applyOrder(ActiveQuery $query, $order)
    {
        switch ($order) {
            case 'oldest':
                $query->orderBy('created_at DESC');
                break;

            case 'active':
                $query->orderBy('created_at ASC');
                break;

            case 'votes':
            default:
                $query->orderBy('votes DESC');
                break;
        }

        return $order;
    }
823335
public function actionIndex()
    {
        $query = ArticleCategory::find()->orderBy(['sort' => SORT_ASC]);
        $dataProvider = new ActiveDataProvider([
            'query' => $query,
            'pagination' => false
        ]);
        return $this->render('index', [
            'dataProvider' => $dataProvider,
        ]);
    }
791107
public function findAllOpenQuery(): AbstractQuery
    {
        $qb = $this->createQueryBuilder('p');

        return $qb
            // Add conditions.
            ->andWhere($qb->expr()->eq('p.active', ':active'))
            ->andWhere($qb->expr()->orX(
                $qb->expr()->isNull('p.expiry'),
                $qb->expr()->gt('p.expiry', ':now')
            ))

            // Add parameters.
            ->setParameter('active', true)
            ->setParameter('now', new \DateTime())

            // Order by and get results.
            ->orderBy('p.name', 'ASC')
            ->getQuery();
    }
836447
protected function setActiveFacets($activeFacets = [])
    {
        $path = $this->prefixWithNamespace('filter');
        $this->argumentsAccessor->set($path, $activeFacets);

        return $this;
    }