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

FullText Criterion not handling properly empty values

    XMLWordPrintable

    Details

      Description

      Detected while testing EZP-22930.
      If you make a Criterion\FullText search with an empty value and you will get the following error:

      [eZ\Publish\Core\Persistence\Database\QueryException] The expression ' OR ' expected at least 1 argument but none provided.

      It's important to notice that, if empty values are not suposed to be used, there should be an exception in the same way Criterion\Subtree does when the path is not in the format /1/2/xxx

      According to the error trace, the problem seems to come from CriterionHandler\FullText->getWordIdSubquery

      #0 /var/www/eZ/530/vendor/ezsystems/ezpublish-kernel/eZ/Publish/Core/Persistence/Doctrine/DoctrineExpression.php(56): eZ\Publish\Core\Persistence\Doctrine\DoctrineExpression->combine(Array, ' OR ')
      #1 /var/www/eZ/530/vendor/ezsystems/ezpublish-kernel/eZ/Publish/Core/Persistence/Legacy/Content/Search/Common/Gateway/CriterionHandler/FullText.php(186): eZ\Publish\Core\Persistence\Doctrine\DoctrineExpression->lOr(Array)
      #2 /var/www/eZ/530/vendor/ezsystems/ezpublish-kernel/eZ/Publish/Core/Persistence/Legacy/Content/Search/Common/Gateway/CriterionHandler/FullText.php(218): eZ\Publish\Core\Persistence\Legacy\Content\Search\Common\Gateway\CriterionHandler\FullText->getWordIdSubquery(Object(eZ\Publish\Core\Persistence\Doctrine\SubselectDoctrineQuery), '')

      Steps to reproduce

      1. Create a command that performs a search with a Criterion\FullText
        $filter = array(
        	'filter' => new Criterion\LogicalAnd( array(
        		new Criterion\FullText( $text ),
        		new Criterion\Subtree( $subtree )
        	) )
        );
          
        $query = new Query( $filter );
        
      2. Execute the command with an empty value for $text
        php ezpublish/console teste:mysearch "" /1/2/12
        

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              Unassigned
              Reporter:
              eduardo.fernandes-obsolete@ez.no Eduardo Fernandes (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

                Dates

                Created:
                Updated: