classes/ezfezpsolrquerybuilder.php
protected function getClassAttributes( $classIDArray = false,
        $classAttributeIDArray = false,
        $fieldTypeExcludeList = null )
    {
        eZDebug::createAccumulator( 'Class attribute list', 'eZ Find' );
        eZDebug::accumulatorStart( 'Class attribute list' );
        $fieldArray = array();

        $classAttributeArray = array();

        // classAttributeIDArray = simple integer (content class attribute ID)
        if ( is_numeric( $classAttributeIDArray ) and $classAttributeIDArray > 0 )
        {
            $classAttributeArray[] = eZContentClassAttribute::fetch( $classAttributeIDArray );
        }
        // classAttributeIDArray = array of integers (content class attribute IDs)
        else if ( is_array( $classAttributeIDArray ) )
        {
            foreach ( $classAttributeIDArray as $classAttributeID )
            {
                $classAttributeArray[] = eZContentClassAttribute::fetch( $classAttributeID );
            }
        }

        // no class attribute list given, we need a class list
        // this block will create the class attribute array based on $classIDArray
        if ( empty( $classAttributeArray ) )
        {
            // Fetch class list.
            $condArray = array( "is_searchable" => 1,
                                "version" => eZContentClass::VERSION_STATUS_DEFINED );
            if ( !$classIDArray )
            {
                $classIDArray = array();
            }
            else if ( !is_array( $classIDArray ) )
            {
                $classIDArray = array( $classIDArray );
            }
            // literal class identifiers are converted to numerical ones
            $tmpClassIDArray = $classIDArray;
            $classIDArray = array();
            foreach ( $tmpClassIDArray as $key => $classIdentifier )
            {
                if ( !is_numeric( $classIdentifier ) )
                {
                    if ( !$contentClass = eZContentClass::fetchByIdentifier( $classIdentifier, false ) )
                    {
                        eZDebug::writeWarning( "Unknown content class identifier '$classIdentifier'", __METHOD__ );
                    }
                    else
                    {
                        $classIDArray[] = $contentClass['id'];
                    }
                }
                else
                {
                    $classIDArray[] = $classIdentifier;
                }
            }

            if ( !empty( $classIDArray ) )
            {
                $condArray['contentclass_id'] = array( $classIDArray );
            }

            $classAttributeArray = eZContentClassAttribute::fetchFilteredList( $condArray );
        }

        // $classAttributeArray now contains a list of eZContentClassAttribute
        // we can use to construct the list of fields solr should search in
        // @TODO : retrieve sub attributes here. Mind the types !
        foreach ( $classAttributeArray as $classAttribute )
        {
            $fieldArray = array_merge( ezfSolrDocumentFieldBase::getFieldNameList( $classAttribute, $fieldTypeExcludeList ), $fieldArray );
        }

        // the array is unified + sorted in order to make it consistent
        $fieldArray = array_unique( $fieldArray );
        sort( $fieldArray );

        eZDebug::accumulatorStop( 'Class attribute list' );
        return $fieldArray;
    }
protected function getClassAttributes( $classIDArray = false,
        $classAttributeIDArray = false,
        $fieldTypeExcludeList = null )
    {
        eZDebug::createAccumulator( 'Class attribute list', 'eZ Find' );
        eZDebug::accumulatorStart( 'Class attribute list' );
        $fieldArray = array();

        $classAttributeArray = array();

        // classAttributeIDArray = simple integer (content class attribute ID)
        if ( is_numeric( $classAttributeIDArray ) and $classAttributeIDArray > 0 )
        {
            $classAttributeArray[] = eZContentClassAttribute::fetch( $classAttributeIDArray );
        }
        // classAttributeIDArray = array of integers (content class attribute IDs)
        else if ( is_array( $classAttributeIDArray ) )
        {
            foreach ( $classAttributeIDArray as $classAttributeID )
            {
                $classAttributeArray[] = eZContentClassAttribute::fetch( $classAttributeID );
            }
        }

        // no class attribute list given, we need a class list
        // this block will create the class attribute array based on $classIDArray
        if ( empty( $classAttributeArray ) )
        {
            // Fetch class list.
            $condArray = array( "is_searchable" => 1,
                                "version" => eZContentClass::VERSION_STATUS_DEFINED );
            if ( !$classIDArray )
            {
                $classIDArray = array();
            }
            else if ( !is_array( $classIDArray ) )
            {
                $classIDArray = array( $classIDArray );
            }
            // literal class identifiers are converted to numerical ones
            $tmpClassIDArray = $classIDArray;
            $classIDArray = array();
            foreach ( $tmpClassIDArray as $key => $classIdentifier )
            {
                if ( !is_numeric( $classIdentifier ) )
                {
                    if ( !$contentClass = eZContentClass::fetchByIdentifier( $classIdentifier, false ) )
                    {
                        eZDebug::writeWarning( "Unknown content class identifier '$classIdentifier'", __METHOD__ );
                    }
                    else
                    {
                        $classIDArray[] = $contentClass['id'];
                    }
                }
                else
                {
                    $classIDArray[] = $classIdentifier;
                }
            }

            if ( !empty( $classIDArray ) )
            {
                $condArray['contentclass_id'] = array( $classIDArray );
            }

            $classAttributeArray = eZContentClassAttribute::fetchFilteredList( $condArray );
        }

        // $classAttributeArray now contains a list of eZContentClassAttribute
        // we can use to construct the list of fields solr should search in
        // @TODO : retrieve sub attributes here. Mind the types !
        foreach ( $classAttributeArray as $classAttribute )
        {
            $fieldArray = array_merge( ezfSolrDocumentFieldBase::getFieldNameList( $classAttribute, $fieldTypeExcludeList ), $fieldArray );
        }

        // the array is unified + sorted in order to make it consistent
        $fieldArray = array_unique( $fieldArray );
        sort( $fieldArray );

        eZDebug::accumulatorStop( 'Class attribute list' );
        return $fieldArray;
    }
protected function getClassAttributes ( $ classIDArray = false , $ classAttributeIDArray = false , $ fieldTypeExcludeList = null ) { eZDebug :: createAccumulator ( 'Class attribute list' , 'eZ Find' ) ; eZDebug :: accumulatorStart ( 'Class attribute list' ) ; $ fieldArray = array ( ) ; $ classAttributeArray = array ( ) ; // classAttributeIDArray = simple integer (content class attribute ID) if ( is_numeric ( $ classAttributeIDArray ) and $ classAttributeIDArray > 0 ) { $ classAttributeArray [ ] = eZContentClassAttribute :: fetch ( $ classAttributeIDArray ) ; } // classAttributeIDArray = array of integers (content class attribute IDs) else if ( is_array ( $ classAttributeIDArray ) ) { foreach ( $ classAttributeIDArray as $ classAttributeID ) { $ classAttributeArray [ ] = eZContentClassAttribute :: fetch ( $ classAttributeID ) ; } } // no class attribute list given, we need a class list // this block will create the class attribute array based on $classIDArray if ( empty ( $ classAttributeArray ) ) { // Fetch class list. $ condArray = array ( "is_searchable" => 1 , "version" => eZContentClass :: VERSION_STATUS_DEFINED ) ; if ( ! $ classIDArray ) { $ classIDArray = array ( ) ; } else if ( ! is_array ( $ classIDArray ) ) { $ classIDArray = array ( $ classIDArray ) ; } // literal class identifiers are converted to numerical ones $ tmpClassIDArray = $ classIDArray ; $ classIDArray = array ( ) ; foreach ( $ tmpClassIDArray as $ key => $ classIdentifier ) { if ( ! is_numeric ( $ classIdentifier ) ) { if ( ! $ contentClass = eZContentClass :: fetchByIdentifier ( $ classIdentifier , false ) ) { eZDebug :: writeWarning ( "Unknown content class identifier '$classIdentifier'" , __METHOD__ ) ; } else { $ classIDArray [ ] = $ contentClass [ 'id' ] ; } } else { $ classIDArray [ ] = $ classIdentifier ; } } if ( ! empty ( $ classIDArray ) ) { $ condArray [ 'contentclass_id' ] = array ( $ classIDArray ) ; } $ classAttributeArray = eZContentClassAttribute :: fetchFilteredList ( $ condArray ) ; } // $classAttributeArray now contains a list of eZContentClassAttribute // we can use to construct the list of fields solr should search in // @TODO : retrieve sub attributes here. Mind the types ! foreach ( $ classAttributeArray as $ classAttribute ) { $ fieldArray = array_merge ( ezfSolrDocumentFieldBase :: getFieldNameList ( $ classAttribute , $ fieldTypeExcludeList ) , $ fieldArray ) ; } // the array is unified + sorted in order to make it consistent $ fieldArray = array_unique ( $ fieldArray ) ; sort ( $ fieldArray ) ; eZDebug :: accumulatorStop ( 'Class attribute list' ) ; return $ fieldArray ; }
Get an array of class attribute identifiers based on either a class attribute
list, or a content classes list

@param array $classIDArray
Classes to search in. Either an array of class ID, class identifiers,
a class ID or a class identifier.
Using numerical attribute/class identifiers for $classIDArray is more efficient.
@param array $classAttributeID
Class attributes to search in. Either an array of class attribute id,
or a single class attribute. Literal identifiers are not allowed.
@param array $fieldTypeExcludeList
filter list. List of field types to exclude. ( set to empty array by default ).

@return array List of solr field names.
Get an array of class attribute identifiers based on either a class attribute list or a content classes list