/**
  * Finds Locations for the given $query.
  *
  * @param \eZ\Publish\API\Repository\Values\Content\LocationQuery $query
  * @param array $fieldFilters - a map of filters for the returned fields.
  *        Currently supported: <code>array("languages" => array(<language1>,..))</code>.
  *
  * @return \eZ\Publish\API\Repository\Values\Content\Search\SearchResult
  */
 public function findLocations(LocationQuery $query, array $fieldFilters = array())
 {
     $query = clone $query;
     $query->filter = $query->filter ?: new Criterion\MatchAll();
     $query->query = $query->query ?: new Criterion\MatchAll();
     $this->coreFilter->apply($query, $fieldFilters, DocumentMapper::DOCUMENT_TYPE_IDENTIFIER_LOCATION);
     return $this->resultExtractor->extract($this->gateway->findLocations($query, $fieldFilters));
 }
 /**
  * @param $locationId
  */
 protected function updateAllElementsWithAdditionalLocation($locationId)
 {
     $query = $this->prepareQuery();
     $query->filter = new Criterion\LogicalAnd([$this->allItemsWithinLocation($locationId), $this->allItemsWithinLocationWithAdditionalLocation($locationId)]);
     $searchResult = $this->resultExtractor->extract($this->gateway->searchAllEndpoints($query));
     $contentItems = [];
     foreach ($searchResult->searchHits as $searchHit) {
         try {
             $contentInfo = $this->contentHandler->loadContentInfo($searchHit->valueObject->id);
         } catch (NotFoundException $e) {
             continue;
         }
         $contentItems[] = $this->contentHandler->load($contentInfo->id, $contentInfo->currentVersionNo);
     }
     $this->bulkIndexContent($contentItems);
 }
 public function __construct(ContentHandler $contentHandler, LocationHandler $locationHandler, FacetBuilderVisitor $facetBuilderVisitor)
 {
     $this->contentHandler = $contentHandler;
     $this->locationHandler = $locationHandler;
     parent::__construct($facetBuilderVisitor);
 }