Neos.Media/Classes/Domain/Repository/AssetRepository.php
public function findBySearchTermOrTags($searchTerm, array $tags = [], AssetCollection $assetCollection = null)
    {
        $query = $this->createQuery();

        $constraints = [
            $query->like('title', '%' . $searchTerm . '%'),
            $query->like('resource.filename', '%' . $searchTerm . '%'),
            $query->like('caption', '%' . $searchTerm . '%')
        ];
        foreach ($tags as $tag) {
            $constraints[] = $query->contains('tags', $tag);
        }
        $query->matching($query->logicalOr($constraints));
        $this->addImageVariantFilterClause($query);
        $this->addAssetCollectionToQueryConstraints($query, $assetCollection);
        return $query->execute();
    }
public function findBySearchTermOrTags($searchTerm, array $tags = [], AssetCollection $assetCollection = null)
    {
        $query = $this->createQuery();

        $constraints = [
            $query->like('title', '%' . $searchTerm . '%'),
            $query->like('resource.filename', '%' . $searchTerm . '%'),
            $query->like('caption', '%' . $searchTerm . '%')
        ];
        foreach ($tags as $tag) {
            $constraints[] = $query->contains('tags', $tag);
        }
        $query->matching($query->logicalOr($constraints));
        $this->addImageVariantFilterClause($query);
        $this->addAssetCollectionToQueryConstraints($query, $assetCollection);
        return $query->execute();
    }
public function findBySearchTermOrTags ( $ searchTerm , array $ tags = [ ] , AssetCollection $ assetCollection = null ) { $ query = $ this -> createQuery ( ) ; $ constraints = [ $ query -> like ( 'title' , '%' . $ searchTerm . '%' ) , $ query -> like ( 'resource.filename' , '%' . $ searchTerm . '%' ) , $ query -> like ( 'caption' , '%' . $ searchTerm . '%' ) ] ; foreach ( $ tags as $ tag ) { $ constraints [ ] = $ query -> contains ( 'tags' , $ tag ) ; } $ query -> matching ( $ query -> logicalOr ( $ constraints ) ) ; $ this -> addImageVariantFilterClause ( $ query ) ; $ this -> addAssetCollectionToQueryConstraints ( $ query , $ assetCollection ) ; return $ query -> execute ( ) ; }
Find assets by title or given tags

@param string $searchTerm
@param array $tags
@param AssetCollection $assetCollection
@return QueryResultInterface
@throws InvalidQueryException
Find assets by title or given tags