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

eZFind buildResultObjects generates notice from "score" (or untokenized fieldnames)

    Details

      Description

      The problem only shows when calling buildResultObjects with $asObjects = false.

      This method attempts to extract field information from the name of the field. However, certain fields are returned that are not tokenized with '_' characters, such as 'score'.

      This result will be an empty array and it generates notices.

        Activity

        Hide
        Paulo Bras (Inactive) added a comment - - edited

        doing a simple search on a default installation (using "publish" as keyword), the method buildResultObjects receives a $resultArray where we can find:
        ["docs"]=> array(10) {
        [0]=> array(13)

        { ["meta_guid_ms"]=> string(32) "3e520ef6891ad8fa233661c77675e4e9" .... ["score"]=> float(1.6398617) }

        this shows a simple example of the $resultArray param received.

        so, if the buildResultObjects is called with $asObjects set to false, the "score" field name does not match:
        foreach ( $doc as $fieldName => $fieldValue )
        {

        ---------------> list($prefix, $rest) = explode ('_', $fieldName, 2);

        Show
        Paulo Bras (Inactive) added a comment - - edited doing a simple search on a default installation (using "publish" as keyword), the method buildResultObjects receives a $resultArray where we can find: ["docs"] => array(10) { [0] => array(13) { ["meta_guid_ms"]=> string(32) "3e520ef6891ad8fa233661c77675e4e9" .... ["score"]=> float(1.6398617) } this shows a simple example of the $resultArray param received. so, if the buildResultObjects is called with $asObjects set to false, the "score" field name does not match: foreach ( $doc as $fieldName => $fieldValue ) { ---------------> list($prefix, $rest) = explode ('_', $fieldName, 2);
        Hide
        Seiji Okamoto added a comment -

        Hi Paulo,

        That's correct, the index 'score' will not explode. However, I believe this is caused by the combination of explode with list:

        See here: http://stackoverflow.com/questions/6576313/how-to-avoid-undefined-offset
        and here: http://stackoverflow.com/questions/1807849/undefined-offset-when-using-php-explode

        While this doesn't cause any fatal errors, it does contribute to messy logs.

        Show
        Seiji Okamoto added a comment - Hi Paulo, That's correct, the index 'score' will not explode. However, I believe this is caused by the combination of explode with list: See here: http://stackoverflow.com/questions/6576313/how-to-avoid-undefined-offset and here: http://stackoverflow.com/questions/1807849/undefined-offset-when-using-php-explode While this doesn't cause any fatal errors, it does contribute to messy logs.
        Hide
        Paulo Bras (Inactive) added a comment - - edited

        EDIT changed pull request to:
        https://github.com/ezsystems/ezfind/pull/121

        Show
        Paulo Bras (Inactive) added a comment - - edited EDIT changed pull request to: https://github.com/ezsystems/ezfind/pull/121
        Show
        Yannick Roger (Inactive) added a comment - Fixed in master : https://github.com/ezsystems/ezfind/commit/931d3236c7ed3f6682f68f151f91a568567ba185
        Hide
        Filipe Dobreira (Inactive) added a comment -

        QA Approved.

        Show
        Filipe Dobreira (Inactive) added a comment - QA Approved.

          People

          • Assignee:
            Unassigned
            Reporter:
            Paulo Bras (Inactive)
          • Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Time Tracking

              Estimated:
              Original Estimate - Not Specified
              Not Specified
              Remaining:
              Remaining Estimate - 0 minutes
              0m
              Logged:
              Time Spent - 2 hours
              2h