private function processTag( eZTagsObject $tag, array &$tagIDs, array &$keywords, $indexParentTags = false, $includeSynonyms = false )
    {
        if ( !$this->indexSynonyms && $tag->isSynonym() )
            $tag = $tag->getMainTag();

        //get keyword in content's locale
        $keyword = $tag->getKeyword( $this->ContentObjectAttribute->attribute( 'language_code' ) );
        if ( !$keyword )
        {
            //fall back to main language
            /** @var eZContentLanguage $mainLanguage */
            $mainLanguage = eZContentLanguage::fetch( $tag->attribute( 'main_language_id') );
            if ( $mainLanguage instanceof eZContentLanguage )
                $keyword = $tag->getKeyword( $mainLanguage->attribute( 'locale' ) );
        }

        if ( $keyword )
        {
            $tagIDs[] = (int) $tag->attribute( 'id' );
            $keywords[] = $keyword;
        }

        if ( $indexParentTags )
        {
            $parentTags = $tag->getPath( true );
            foreach ( $parentTags as $parentTag )
            {
                if ( $parentTag instanceof eZTagsObject )
                {
                    $this->processTag( $parentTag, $tagIDs, $keywords );
                }
            }
        }

        if ( $this->indexSynonyms && $includeSynonyms )
        {
            foreach ( $tag->getSynonyms() as $synonym )
            {
                if ( $synonym instanceof eZTagsObject )
                {
                    $this->processTag( $synonym, $tagIDs, $keywords );
                }
            }
        }
    }