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

Class filtering on a standard content search is broken when parameter is given as a class identifier array

    XMLWordPrintable

Details

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Medium Medium
    • 4.2.0alpha1
    • 4.0.0
    • None
    • Operating System: Debian Etch, Mandriva
      PHP Version: 5.2.6

    Description

      When using a class filter in a native fetch(content,search), given as a parameter "class_id" array, eZ find results will be erroneous.
      Although documentation and behavior standard eZ content search confirm that it can be handled this way (just deactivate eZ find to make it work). The classID syntax works fine, only class identifier syntax is broken in an array, but as commonly used it could have some important issues on existing projects.

      Indeed, it seems that the identifier is not properly handled in function getClassAttributes() of class ezfeZPSolrQueryBuilder. Also the parameter is called $classIDArray, so maybe conversion has to be made before, but it's not and identifier comes there. As not properly recognized, no corresponding attributes are returned by this method, and search attribute fields are not properly given to solr. Results are then unconsistent.

      Steps to reproduce
      • Create an article, and fill its body with a sample text. This sample text will be used to search, be careful to use a text that won't be present in meta fields (as object name or something like), as this could change search behavior (meta criterias are them well included in the solr request)
      • In a template, create a search request using native search fetch:
        {def $search=fetch( 'content', 'search',
               hash( text, 'sampletext',
               class_id, array( 2 )
         ) )}
         {$search|attribute('show',2)}

        (considering that classID of the created article is "2")

      • Then try to perform a search, you should have a normal behavior, result is correctly found and returned
      • You can now change the fetch to use a class identifier instead of a class ID, the code will look like:
        {def $search=fetch( 'content', 'search',
               hash( text, 'sampletext',
               class_id, array( 'article' )
         ) )}
      • Then reperform your search, you should see that your article is not returned any more. The reason is the target attributes are not specified any more in the solr request, then search only covers meta informations and is then unconsistent.
      • Note that when used as a simple string value (not in an array), as can be:
        {def $search=fetch( 'content', 'sampletext',
               hash( text, 'test',
               class_id, 'article'
         ) )}

        the search will work properly. This use cas seems to be operated, only a class_identifier specified in an array will be broken.

      Attachments

        Activity

          People

            bd bd
            alexandre.nion alexandre.nion
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: