Searches for torrent and searches for each found torrent in their user for more torrents, to create complete sets

@param string $query The query to search for
@param array $options Extra options for the nyaa feed
@return NyaaSet[]
503181
public function collectRecursive($query, $options = [])
  {
    $feed = $this->getFeed($query, $options);

    $userIds = [];

    foreach ($feed as $torrent) {
      if (!isset($userIds[$torrent->getSeriesHash()])) {
        $userIds[$torrent->getSeriesHash()] = $torrent->getUserId();
      }
    }

    $userIds = array_unique(array_values($userIds));

    return $this->collectForUser($query, $userIds, $options);
  }
801135
public function findOnlyTrashed(Query $query, array $options)
    {
        return $query->andWhere($query->newExpr()->isNotNull($this->getTrashField()));
    }
896785
public function slPlatsuppslag($query, array $options = []) {
        $params = ['key' => $this->slPlatsuppslagKey, 'searchstring' => $query];
        $params = array_merge($params, $options);

        $request = $this->client->request('GET', $this->SlPlatsuppslagURL, [
            'query' => $params
        ]);

        $json = json_decode($request->getBody(), true);
        return $json['ResponseData'];
    }
1169731
public function findAllByQuery($query, array $params = array()) {
		//Not using the parent findAllByQuery() implementation, becaus
		//it performs one-by-one EAV fetching, which is very bad for performance.
		//Instead, we find all main records with 1 query. And then fine all EAV entries (for all),
		//with a single additional query (instead of one per main record).

		$records = array();
		$recordIds = array();
		foreach ($this->db->fetchAll($query, $params) as $data) {
			$records[] = $data;
			$recordIds[] = $data['_id'];
		}

		$dataPerNamespaceFlattened = $this->pullEavDataForAll($recordIds);

		$results = array();
		foreach ($records as $data) {
			$data['__eav_data__'] = $dataPerNamespaceFlattened[$data['_id']];
			$results[] = $this->loadModel($data);
		}

		return $results;
	}
937135
protected function filter($query, EntryQueryOptions $options)
    {
        if ($options->familyHash || $options->tag || $options->batchId) {
            return $this;
        }

        $query->where('should_display_on_index', true);

        return $this;
    }
962616
public function createSearch($query = '', $options = null, BuilderInterface $builder = null)
    {
        $search = new Search($this->getClient(), $builder);
        $search->addIndex($this);
        $search->setOptionsAndQuery($options, $query);

        return $search;
    }
1203855
public function search($query, array $options = [])
    {
        // Max number of records to fetch. Set to 0 to fetch all.
        $limit = array_key_exists('limit', $options) ? $options['limit'] : 0;

        // Set to true to do a phrase search
        $phrase = array_key_exists('phrase', $options) ? $options['phrase'] : false;

        // Set to true to expand all query results to full records.
        // Please note that this will make queries significantly slower!
        $expand = array_key_exists('expand', $options) ? $options['expand'] : false;

        // Number of records to fetch each batch. Usually no need to change this.
        $batchSize = array_key_exists('batchSize', $options) ? $options['batchSize'] : 10;

        if ($limit != 0 && $limit < $batchSize) {
            $batchSize = $limit;
        }

        // The API will throw a 400 response if you include properly encoded spaces,
        // but underscores work as a substitute.
        $query = explode(' AND ', $query);
        $query = $phrase ? str_replace(' ', '_', $query) : str_replace(' ', ',', $query);
        $query = implode(' AND ', $query);

        $offset = 0;
        while (true) {
            $response = $this->client->getJSON('/users', ['q' => $query, 'limit' => $batchSize, 'offset' => $offset]);

            // The API sometimes returns total_record_count: -1, with no further error message.
            // Seems to indicate that the query was not understood.
            // See: https://github.com/scriptotek/php-alma-client/issues/8
            if ($response->total_record_count == -1) {
                throw new InvalidQuery($query);
            }

            if ($response->total_record_count == 0) {
                break;
            }

            if (!isset($response->user) || empty($response->user)) {
                // We cannot trust the value in 'total_record_count', so if there are no more records,
                // we have to assume the result set is depleted.
                // See: https://github.com/scriptotek/php-alma-client/issues/7
                break;
            }

            foreach ($response->user as $data) {
                $offset++;
                // Contacts without a primary identifier will have the primary_id
                // field populated with something weird like "no primary id (123456789023)".
                // We ignore those.
                // See: https://github.com/scriptotek/php-alma-client/issues/6
                if (strpos($data->primary_id, 'no primary id') === 0) {
                    continue;
                }
                $user = User::make($this->client, $data->primary_id)
                    ->init($data);
                if ($expand) {
                    $user->init();
                }
                yield $user;
            }
            if ($offset >= $response->total_record_count) {
                break;
            }
            if ($limit != 0 && $offset >= $limit) {
                break;
            }
        }
    }
520620
public static function search($query) {
    global $server;
    $response = $server->doCall('search', ['query' => $query]);
    $result = [];
    foreach ($response->getValue('list') as $item) {
      $result[] = ['type' => $item['type'], 'oid' => $item['oid'],
        'displayValue' => $item['displayValue'], 'summary' => $item['summary']
      ];
    }
    return ['return' => $result];
  }
583773
public function search($query)
    {
        $this->logger->debug('Meda:search');
        if (!Tools::isGoodString($query)) {
            $this->logger->error('Media::search: invalid query');
            return [];
        }
        $this->setGeneratorSearch($query, self::MEDIA_NAMESPACE);
        return $this->getImageinfoResponse();
    }
675346
public function queryAssoc($query, $options = array())
    {
        $statement = $this->_runQuery($query, $options);
        return $statement->fetch(\PDO::FETCH_ASSOC);
    }
1230278
public function findRandom(Query $query, array $options)
    {
        $query->order('rand()');

        if (!$query->clause('limit')) {
            $query->limit(1);
        }

        return $query;
    }
178047
public function search($query)
    {
        $this->logger->debug('Page:search');
        if (!Tools::isGoodString($query)) {
            $this->logger->error('Page::search: invalid query');
            return [];
        }
        $this->setGeneratorSearch($query, self::PAGE_NAMESPACE);
        $this->setParam('prop', 'pageprops');
        $this->send();
        return Tools::flatten($this->getResponse(['query', 'pages']));
    }
88852
public function search($query)
    {
        $this->logger->debug('Category:search:', [$query]);
        if (!Tools::isGoodString($query)) {
            $this->logger->error('Category::search: invalid query');
            return [];
        }
        $this->setGeneratorSearch($query, self::CATEGORY_NAMESPACE);
        return $this->getCategoryinfoResponse();
    }
1214782
public function search(string $query, array $arguments = null)
    {
        $args = ['q' => $query];
        if (is_array($arguments)) {
            $args = array_merge($arguments, $args);
        }
        return new SearchIterator($this, 'search/tweets', $args);
    }
918255
public function queryList($query, $options = array())
    {
        $statement = $this->_runQuery($query, $options);
        return $statement->fetch(\PDO::FETCH_NUM);
    }
986154
public function findSitemapRecords(Query $query, array $options) {
		$query = $query
			->where($this->_config['conditions'])
			->cache("sitemap_{$query->repository()->alias()}", $this->_config['cacheConfigKey'])
			->order($this->_config['order'])
			->formatResults(function ($results) {
				return $this->mapResults($results);
			});

		if (!empty($this->_config['fields'])) {
			$query = $query->select($this->_config['fields']);
		}

		return $query;
	}
50969
public function findAll(array $query = [])
    {
        $data = $this->client->get(Inflector::pluralize($this->getResourceName()), $query);

        return $this->createMany(reset($data));
    }