Extracts the number of pending, indexed and erroneous items from the
Index Queue.

@param int $rootPid
@param string $indexingConfigurationName

@return QueueStatistic
352821
public function findOneByRootPidAndOptionalIndexingConfigurationName(int $rootPid, $indexingConfigurationName = null): QueueStatistic
    {
        $queryBuilder = $this->getQueryBuilder();
        $queryBuilder
            ->add('select', vsprintf('(%s < %s) AS %s', [
                $queryBuilder->quoteIdentifier('indexed'),
                $queryBuilder->quoteIdentifier('changed'),
                $queryBuilder->quoteIdentifier('pending')
            ]), true)
            ->add('select', vsprintf('(%s) AS %s', [
                $queryBuilder->expr()->notLike('errors', '""'),
                $queryBuilder->quoteIdentifier('failed')
            ]), true)
            ->add('select', $queryBuilder->expr()->count('*', 'count'), true)
            ->from($this->table)
            ->where($queryBuilder->expr()->eq('root', $queryBuilder->createNamedParameter($rootPid, \PDO::PARAM_INT)))
            ->groupBy('pending', 'failed');

        if (!empty($indexingConfigurationName)) {
            $queryBuilder->andWhere($queryBuilder->expr()->eq('indexing_configuration', $queryBuilder->createNamedParameter($indexingConfigurationName)));
        }

        return $this->buildQueueStatisticFromResultSet($queryBuilder->execute()->fetchAll());
    }
342213
public int getNumPartitions(String topicName) {
        Map<String, List<PartitionInfo>> topicInfo = getTopicInfo();
        List<PartitionInfo> partitionInfo = topicInfo != null ? topicInfo.get(topicName) : null;
        return partitionInfo != null ? partitionInfo.size() : 0;
    }
78384
public static function getDomain($rootPid)
    {
        // Use cached one if exists
        if (isset(self::$domainCache[$rootPid])) {
            return self::$domainCache[$rootPid];
        }

        // Fetch domain name
        $query = 'SELECT domainName
                    FROM sys_domain
                   WHERE pid = ' . (int)$rootPid . '
                     AND hidden = 0
                ORDER BY forced DESC,
                         sorting
                   LIMIT 1';
        $ret   = DatabaseUtility::getOne($query);

        // Remove possible slash at the end
        $ret = rtrim($ret, '/');

        // Cache entry
        self::$domainCache[$rootPid] = $ret;

        return $ret;
    }
456859
public function getIndexByName($indexName, $tableName)
    {
        $indices = $this->getIndices($tableName);

        $result = null;

        foreach ($indices as $index) {
            if ($indexName === $index['Column_name']) {
                $result = $index;
            }
        }

        return $result;
    }
971423
public function findDomainRecordsByRootPagesIds(array $rootPageIds = [])
    {
        $resultTmp = $this->getDomainRecordsByRootPageIds($rootPageIds);

        $result = [];
        foreach ($resultTmp as $key => $row) {
            $result[$row['pid']] = $row;
        }
        return $result;
    }
535166
public function getInitialPagesAdditionalWhereClause($configurationName)
    {
        $path = 'plugin.tx_solr.index.queue.' . $configurationName . '.initialPagesAdditionalWhereClause';
        $initialPagesAdditionalWhereClause = $this->getValueByPathOrDefaultValue($path, '');

        if (trim($initialPagesAdditionalWhereClause) === '') {
            return '';
        }

        return trim($initialPagesAdditionalWhereClause);
    }
1280619
@Override
  public List<String> indexKeys(String indexName, String indexKey) {
    lock.lock();
    try {
      if (!this.indexers.containsKey(indexName)) {
        throw new IllegalArgumentException(String.format("index %s doesn't exist!", indexName));
      }
      Map<String, Set<String>> index = this.indices.get(indexName);
      Set<String> set = index.get(indexKey);
      List<String> keys = new ArrayList<>(set.size());
      for (String key : set) {
        keys.add(key);
      }
      return keys;
    } finally {
      lock.unlock();
    }
  }
1200667
public function getSearchStatistics(int $rootPageId, int $days = 30, $limit = 10)
    {
        $now = time();
        $timeStart = (int)($now - 86400 * $days); // 86400 seconds/day
        $limit = (int)$limit;

        return $this->getPreparedQueryBuilderForSearchStatisticsAndTopKeywords($rootPageId, $timeStart, $limit)
            ->execute()->fetchAll();
    }
1139134
public function getIndex($indexName)
    {
        return $this->reduceFirst(function (SearchProviderInterface $provider) use ($indexName) {
            return $provider->getIndex($this->indexNamePrefix . $indexName);
        });
    }
597844
def atlasdb_get_zonefiles_missing_count_by_name(name, max_index=None, indexes_exclude=[], con=None, path=None):
    
    with AtlasDBOpen(con=con, path=path) as dbcon:
        sql = 'SELECT COUNT(*) FROM zonefiles WHERE name = ? AND present = 0 {} {};'.format(
                'AND inv_index <= ?' if max_index is not None else '',
                'AND inv_index NOT IN ({})'.format(','.join([str(int(i)) for i in indexes_exclude])) if len(indexes_exclude) > 0 else ''
                )

        args = (name,)
        if max_index is not None:
            args += (max_index,)

        cur = dbcon.cursor()
        res = atlasdb_query_execute(cur, sql, args)
        for row in res:
            return row['COUNT(*)']
1155206
private static String getPID() {
        String name = ManagementFactory.getRuntimeMXBean().getName();
        int index = name.indexOf('@');
        if (index == -1) {
            return null;
        }

        String pid = name.substring(0, index);
        if (!pid.matches("[0-9]+")) {
            return null;
        }

        return pid;
    }
1101009
public function getStatistics($index, $num)
    {
        $result = ProcessManager::getInstance()->getRpcCall(SDHelpProcess::class)->getStatistics($index, $num);
        return $result;
    }
203055
public function getStatisticsBySite(Site $site, $indexingConfigurationName = '')
    {
        return $this->queueStatisticsRepository->findOneByRootPidAndOptionalIndexingConfigurationName($site->getRootPageId(), $indexingConfigurationName);
    }
795203
public function getIndex($indexName)
    {
    	if (array_key_exists($indexName, $this->indices)) {
	    	return $this->indices[$indexName];
    	}

    	return null;
    }
772366
public boolean indexExists(String indexName) {
        return this.client.admin().indices().prepareExists(indexName).execute().actionGet().isExists();
    }
756458
public function index(string $indexName = null)
    {
        $this->indexName = $indexName ?? $this->tableName . '_' . $this->name . '_index';

        return $this;
    }
661521
public function getIndexQueueAdditionalWhereClauseByConfigurationName($configurationName)
    {
        $path = 'plugin.tx_solr.index.queue.' . $configurationName . '.additionalWhereClause';
        $additionalWhere = $this->getValueByPathOrDefaultValue($path, '');

        if (trim($additionalWhere) === '') {
            return '';
        }

        return ' AND ' . $additionalWhere;
    }