public function SearchApiSolrBackend::extractContentFromFile in Search API Solr 8.2
Same name and namespace in other branches
- 8.3 src/Plugin/search_api/backend/SearchApiSolrBackend.php \Drupal\search_api_solr\Plugin\search_api\backend\SearchApiSolrBackend::extractContentFromFile()
- 8 src/Plugin/search_api/backend/SearchApiSolrBackend.php \Drupal\search_api_solr\Plugin\search_api\backend\SearchApiSolrBackend::extractContentFromFile()
- 4.x src/Plugin/search_api/backend/SearchApiSolrBackend.php \Drupal\search_api_solr\Plugin\search_api\backend\SearchApiSolrBackend::extractContentFromFile()
Extract a file's content using tika within a solr server.
Parameters
string $filepath: The real path of the file to be extracted.
Return value
string The text extracted from the file.
Overrides SolrBackendInterface::extractContentFromFile
File
- src/
Plugin/ search_api/ backend/ SearchApiSolrBackend.php, line 3408
Class
- SearchApiSolrBackend
- Apache Solr backend for search api.
Namespace
Drupal\search_api_solr\Plugin\search_api\backendCode
public function extractContentFromFile($filepath) {
$connector = $this
->getSolrConnector();
$query = $connector
->getExtractQuery();
$query
->setExtractOnly(TRUE);
$query
->setFile($filepath);
// Execute the query.
$result = $connector
->extract($query);
return $connector
->getContentFromExtractResult($result, $filepath);
}