protected function SearchApiSolrTest::getFieldsAndMapping in Search API Solr 8
Same name and namespace in other branches
- 8.2 tests/src/Kernel/SearchApiSolrTest.php \Drupal\Tests\search_api_solr\Kernel\SearchApiSolrTest::getFieldsAndMapping()
Gets the Drupal Fields and their Solr mapping.
Parameters
\Drupal\search_api_solr\SolrBackendInterface $backend: The backend the mapping is used for.
Return value
array [$fields, $mapping]
2 calls to SearchApiSolrTest::getFieldsAndMapping()
- SearchApiSolrTest::testQueryConditions in tests/
src/ Kernel/ SearchApiSolrTest.php - Tests the conversion of Search API queries into Solr queries.
- SearchApiSolrTest::testQueryConditionsAndLanguageFilter in tests/
src/ Kernel/ SearchApiSolrTest.php - Tests the conversion of language aware queries into Solr queries.
File
- tests/
src/ Kernel/ SearchApiSolrTest.php, line 351
Class
- SearchApiSolrTest
- Tests index and search capabilities using the Solr search backend.
Namespace
Drupal\Tests\search_api_solr\KernelCode
protected function getFieldsAndMapping(SolrBackendInterface $backend) {
/** @var \Drupal\search_api\IndexInterface $index */
$index = Index::load($this->indexId);
$fields = $index
->getFields();
$fields += $this
->invokeMethod($backend, 'getSpecialFields', [
$index,
]);
$field_info = array(
'type' => 'string',
'original type' => 'string',
);
$fields['x'] = $this->fieldsHelper
->createField($index, 'x', $field_info);
$fields['y'] = $this->fieldsHelper
->createField($index, 'y', $field_info);
$fields['z'] = $this->fieldsHelper
->createField($index, 'z', $field_info);
$mapping = $backend
->getSolrFieldNames($index) + [
'x' => 'solr_x',
'y' => 'solr_y',
'z' => 'solr_z',
];
return [
$fields,
$mapping,
];
}