public function getTagContent()
    {
        $result = [];
        $matches = [];
        $content = $this->getContentMarkedForIndexing();

        // strip all ignored tags
        $content = strip_tags(
            $content,
            '<' . implode('><', array_keys($this->tagToFieldMapping)) . '>'
        );

        preg_match_all(
            '@<(' . implode('|',
                array_keys($this->tagToFieldMapping)) . ')[^>]*>(.*)</\1>@Ui',
            $content,
            $matches
        );

        foreach ($matches[1] as $key => $tag) {
            // We don't want to index links auto-generated by the url filter.
            $pattern = '@(?:http://|https://|ftp://|mailto:|smb://|afp://|file://|gopher://|news://|ssl://|sslv2://|sslv3://|tls://|tcp://|udp://|www\.)[a-zA-Z0-9]+@';
            if ($tag != 'a' || !preg_match($pattern, $matches[2][$key])) {
                $fieldName = $this->tagToFieldMapping[$tag];
                $hasContentForFieldName = empty($result[$fieldName]);
                $separator = ($hasContentForFieldName) ? '' : ' ';
                $result[$fieldName] .= $separator . $matches[2][$key];
            }
        }

        return $result;
    }
public function getTagContent()
    {
        $result = [];
        $matches = [];
        $content = $this->getContentMarkedForIndexing();

        // strip all ignored tags
        $content = strip_tags(
            $content,
            '<' . implode('><', array_keys($this->tagToFieldMapping)) . '>'
        );

        preg_match_all(
            '@<(' . implode('|',
                array_keys($this->tagToFieldMapping)) . ')[^>]*>(.*)</\1>@Ui',
            $content,
            $matches
        );

        foreach ($matches[1] as $key => $tag) {
            // We don't want to index links auto-generated by the url filter.
            $pattern = '@(?:http://|https://|ftp://|mailto:|smb://|afp://|file://|gopher://|news://|ssl://|sslv2://|sslv3://|tls://|tcp://|udp://|www\.)[a-zA-Z0-9]+@';
            if ($tag != 'a' || !preg_match($pattern, $matches[2][$key])) {
                $fieldName = $this->tagToFieldMapping[$tag];
                $hasContentForFieldName = empty($result[$fieldName]);
                $separator = ($hasContentForFieldName) ? '' : ' ';
                $result[$fieldName] .= $separator . $matches[2][$key];
            }
        }

        return $result;
    }
public function getTagContent ( ) { $ result = [ ] ; $ matches = [ ] ; $ content = $ this -> getContentMarkedForIndexing ( ) ; // strip all ignored tags $ content = strip_tags ( $ content , '<' . implode ( '><' , array_keys ( $ this -> tagToFieldMapping ) ) . '>' ) ; preg_match_all ( '@<(' . implode ( '|' , array_keys ( $ this -> tagToFieldMapping ) ) . ')[^>]*>(.*)</\1>@Ui' , $ content , $ matches ) ; foreach ( $ matches [ 1 ] as $ key => $ tag ) { // We don't want to index links auto-generated by the url filter. $ pattern = '@(?:http://|https://|ftp://|mailto:|smb://|afp://|file://|gopher://|news://|ssl://|sslv2://|sslv3://|tls://|tcp://|udp://|www\.)[a-zA-Z0-9]+@' ; if ( $ tag != 'a' || ! preg_match ( $ pattern , $ matches [ 2 ] [ $ key ] ) ) { $ fieldName = $ this -> tagToFieldMapping [ $ tag ] ; $ hasContentForFieldName = empty ( $ result [ $ fieldName ] ) ; $ separator = ( $ hasContentForFieldName ) ? '' : ' ' ; $ result [ $ fieldName ] .= $ separator . $ matches [ 2 ] [ $ key ] ; } } return $ result ; }
Extracts HTML tag content from tags in the content marked for indexing.

@return array A mapping of Solr document field names to content found in defined tags.
Extracts HTML tag content from tags in the content marked for indexing .