public static function SolrExtractor::extractBody in Search API attachments 8
Same name and namespace in other branches
- 9.0.x src/Plugin/search_api_attachments/SolrExtractor.php \Drupal\search_api_attachments\Plugin\search_api_attachments\SolrExtractor::extractBody()
Extract the body from XML response.
2 calls to SolrExtractor::extractBody()
- ExtractBody::testSetValues in tests/
src/ Unit/ ExtractBody.php - Tests setting the Values.
- SolrExtractor::extract in src/
Plugin/ search_api_attachments/ SolrExtractor.php - Extract file with a search api solr backend.
File
- src/
Plugin/ search_api_attachments/ SolrExtractor.php, line 87
Class
- SolrExtractor
- Provides solr extractor.
Namespace
Drupal\search_api_attachments\Plugin\search_api_attachmentsCode
public static function extractBody($xml_data) {
if (!preg_match(',<body[^>]*>(.*)</body>,sim', $xml_data, $matches)) {
// If the body can't be found return just the text. This will be safe
// and contain any text to index.
return strip_tags($xml_data);
}
// Return the full content of the body. Including tags that can optionally
// be used for index weight.
return $matches[1];
}