Uploaded image for project: 'eZ Publish / Platform'
  1. eZ Publish / Platform
  2. EZP-31226

Indexing depth doesn't work properly in Solr when LocationQuery is in use

    XMLWordPrintable

Details

    Description

      The customer observed that indexing_depth parameter is ignored when searching for Locations with Solr configured.

      Steps to reproduce:
      1. Create a fresh installation of eZ Platform and set Solr as the search engine.
      2. Configure indexing_depth parameter for some CT e.g. "Article" like follows:

      ez_search_engine_solr:
          indexing_depth:
              content_type:
                  article: 2
      

      3. Add a new article and name it "test".
      3. Create another article "test1" and place it as an embed in "test".
      4. Reindex Solr: php bin/console --env=dev --siteaccess=admin ezplatform:reindex
      5. Enter "Search" view in the BO and search for "test1". As indexing_depth is set to 2 you should be presented with two results ("test1" and "test").
      6. Try to perform a similar search using the following command:

      <?php
      
      namespace AppBundle\Command;
      
      use eZ\Publish\API\Repository\Values\Content\LocationQuery;
      use Symfony\Bundle\FrameworkBundle\Command\ContainerAwareCommand;
      use Symfony\Component\Console\Input\InputInterface;
      use Symfony\Component\Console\Output\OutputInterface;
      use eZ\Publish\API\Repository\Values\Content\Query\Criterion;
      
      class FindContentCommand extends ContainerAwareCommand
      {
          protected function configure()
          {
              $this->setName('app:find-content');
          }
      
          protected function execute(InputInterface $input, OutputInterface $output)
          {
              $repository = $this->getContainer()->get('ezpublish.api.repository');
              $searchService = $repository->getSearchService();
      
              $text = 'test1';
              $query = new LocationQuery();
              $query->query = new Criterion\FullText($text);
      
              $result = $searchService->findLocations($query);
      
              foreach ($result->searchHits as $searchHit) {
                  $output->writeln($searchHit->valueObject->contentInfo->name);
              }
          }
      }
      

      Result:
      The searchHits array contains only "text1" and has no information about related content.

      Expected result:
      Also "text" content should be found as it is related.

      Note:
      Running the same command but using eZ\Publish\API\Repository\Values\Content\Query produces two results as expected.

      Attachments

        Activity

          People

            Unassigned Unassigned
            konrad.oboza@ibexa.co Konrad Oboza
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: