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

Usage of field filter useAlwaysAvailable for SearchService should default to true

    XMLWordPrintable

Details

    Description

      When using SearchService's findContent() with the new implementation (EZP-23524) using field filters, the field filter "useAlwaysAvailable" defaults to false instead of true.
      Steps to reproduce:

      1. Ensure a installation without demo content with eng-GB as default language and fre-FR as secondary language;

      2. On legacy admin, at "Home", create:
      folder "Folder" in eng-GB
      folder "FolderFR" in fre-FR
      folder "FolderEN" in eng-GB

      3. Use on a custom bundle the following code to perform a search query:

      $query = new Query();
      $query->filter = new Criterion\Field( "name", Criterion\Operator::CONTAINS, "Folder" );
      $searchResult = $searchService->findContent( $query, array( "languages" => array( "fre-FR" ) ) );
      
      /* Results */
      foreach( $searchResult->searchHits as $searchHit )
      {
      	$output->writeln( $searchHit->valueObject->contentInfo->name );
      }
      
      

      and verify that you'll get only the following results:

      FolderFR
      

      whereas you should get instead:

      Folder
      FolderFR
      FolderEN
      

      since, by using

      $useAlwaysAvailable=true
      

      or simply omitting it from the array at:

      findContent( $query, array( "languages" => array( "fre-FR" ) ) )
      

      it should add the default language 'eng-GB' to the array of searchable languages and thus, retrieve results found on both fre-FR and eng-GB languages.

      Attachments

        Activity

          People

            Unassigned Unassigned
            rui.silva-obsolete@ez.no Rui Silva (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated: