Details
-
Bug
-
Resolution: Fixed
-
High
-
2.5.5
-
None
Description
Using Criterion\Field for searching for Contents with fields that are empty will make Solr throw an exception.
Steps to reproduce
1. Clean installation of eZ Platform 2.5.5
2. Create a test Command:
<?php //src/AppBundle/Command/SearchCommand.php namespace AppBundle\Command; use eZ\Publish\API\Repository\SearchService; use eZ\Publish\API\Repository\Values\Content\Query; use Symfony\Bundle\FrameworkBundle\Command\ContainerAwareCommand; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; class SearchCommand extends ContainerAwareCommand { protected function configure() { $this->setName('app:search'); } protected function execute(InputInterface $input, OutputInterface $output) { $repository = $this->getContainer()->get('ezpublish.api.repository'); /** @var SearchService $searchService */ $searchService = $repository->getSearchService(); $testQuery = new Query(); $testQuery->query = new Query\Criterion\LogicalAnd([ new Query\Criterion\ContentTypeIdentifier('folder'), new Query\Criterion\Field('short_name', Query\Criterion\Operator::EQ, NULL), ]); $searchResult = $searchService->findContent($testQuery); foreach ( $searchResult->searchHits as $searchHit ) { $output->writeln( $searchHit->valueObject->contentInfo->name ); } } }
3. Set Solr as a search engine.
4. Run bin/console app:search.
Result
Command will fail with Solr ParseException.
Excepted Result
All folders with short_name not set are returned.