You are viewing a plain text version of this content. The canonical link for it is here.
Posted to zeta-issues@incubator.apache.org by "David Rekowski (Commented) (JIRA)" <ji...@apache.org> on 2011/10/25 14:56:32 UTC

[jira] [Commented] (ZETACOMP-88) Type field are not correctly set

    [ https://issues.apache.org/jira/browse/ZETACOMP-88?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13135110#comment-13135110 ] 

David Rekowski commented on ZETACOMP-88:
----------------------------------------

I had the same issue, but I think it should be:

public function mapFieldValuesForReturn( $field, $values )
    {
        if ( $field->multi )
        {
            foreach ( $values as &$value )
            {
                $value = $this->mapFieldValueForReturn( $field->type, $value );
            }
        }
        elseif (is_array($values))
        {
            $values = $this->mapFieldValueForReturn( $field->type, $values[0] );
        }
        else
        {
            $values = $this->mapFieldValueForReturn( $field->type, $values );
        }
        return $values;
    }

Otherwise, you fetch the array element and then map its first element.
                
> Type field are not correctly set
> --------------------------------
>
>                 Key: ZETACOMP-88
>                 URL: https://issues.apache.org/jira/browse/ZETACOMP-88
>             Project: Zeta Components
>          Issue Type: Bug
>          Components: Search
>            Reporter: Maxime THOMAS - Wascou.org
>            Priority: Critical
>              Labels: mapping, search, type
>   Original Estimate: 1h
>  Remaining Estimate: 1h
>
> I've got an issue on doing a search with the SolR class and trying to sort by a date field.
> Apparently the mapping on not multivalued field was not done correctly and the mapFieldValuesForReturn function of ezcSearchSolrHandler was returning an error.
> After analysis, the mapping is done on values that could be either string / numbers or arrays.
> Here's the fix I've done for this function :
> public function mapFieldValuesForReturn( $field, $values )
>     {
>         if ( $field->multi )
>         {
>             foreach ( $values as &$value )
>             {
>                 $value = $this->mapFieldValueForReturn( $field->type, $value );
>             }
>         }
>         else
>         {
>             if ( is_array($values) )
>             {
>                 $values = $values[0];
>             }
>             $values = $this->mapFieldValueForReturn( $field->type, $values[0] );
>         }
>         return $values;
>     }
> It was critical as the handler did the query but cannot fill the object in return, so no results in the search.
> If it can be quickly integrated in a release, it would be cool.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira