public function findContentInfo(Query $query) { $searchResult = $this->searchService->findContentInfo($query, ['languages' => $this->prioritizedLanguages, 'useAlwaysAvailable' => $this->useAlwaysAvailable]); foreach ($searchResult->searchHits as $searchHit) { /** @var \eZ\Publish\API\Repository\Values\Content\ContentInfo $contentInfo */ $contentInfo = $searchHit->valueObject; $searchHit->valueObject = $this->domainObjectMapper->mapContentInfo($this->contentService->loadVersionInfo($contentInfo, $contentInfo->currentVersionNo), $searchHit->matchedTranslation); } return $searchResult; }
/** * Returns all places contained in a place_list that are located between the range defined in * the default configuration. A sort clause array can be provided in order to sort the results. * * @param \eZ\Publish\API\Repository\Values\Content\Location $location of a place_list * @param float $latitude * @param float $longitude * @param string|string[] $contentTypes to be retrieved * @param int $maxDist Maximum distance for the search in km * @param array $sortClauses * @param string|string[] $languages to be retrieved * * @return \eZ\Publish\API\Repository\Values\Content\Content[] */ public function getPlaceListSorted(Location $location, $latitude, $longitude, $contentTypes, $maxDist = null, $sortClauses = array(), $languages = array()) { if ($maxDist === null) { $maxDist = $this->placeListMaxDist; } $query = new Query(); $query->filter = new Criterion\LogicalAnd(array(new Criterion\ContentTypeIdentifier($contentTypes), new Criterion\Subtree($location->pathString), new Criterion\LanguageCode($languages), new Criterion\MapLocationDistance('location', Criterion\Operator::BETWEEN, array($this->placeListMinDist, $maxDist), $latitude, $longitude))); $query->sortClauses = $sortClauses; $query->performCount = false; $searchResults = $this->searchService->findContentInfo($query); return $this->searchHelper->buildListFromSearchResult($searchResults); }
/** * Finds contentInfo objects for the given query. * * @see SearchServiceInterface::findContentInfo() * * @since 5.4.5 * @throws \eZ\Publish\API\Repository\Exceptions\InvalidArgumentException if query is not valid * * @param \eZ\Publish\API\Repository\Values\Content\Query $query * @param array $languageFilter - a map of filters for the returned fields. * Currently supports: <code>array("languages" => array(<language1>,..), "useAlwaysAvailable" => bool)</code> * useAlwaysAvailable defaults to true to avoid exceptions on missing translations. * @param bool $filterOnUserPermissions if true (default) only the objects which is the user allowed to read are returned. * * @return \eZ\Publish\API\Repository\Values\Content\Search\SearchResult */ public function findContentInfo(Query $query, array $languageFilter = array(), $filterOnUserPermissions = true) { return $this->service->findContentInfo($query, $languageFilter, $filterOnUserPermissions); }