protected function SearchApiSolrTest::getFieldsAndMapping in Search API Solr 8.2
Same name and namespace in other branches
- 8 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]
3 calls to SearchApiSolrTest::getFieldsAndMapping()
- SearchApiSolrMultilingualTest::testQueryConditionsAndLanguageFilter in tests/
src/ Kernel/ SearchApiSolrMultilingualTest.php - Tests the conversion of language aware queries into Solr queries.
- 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 227
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 = [
'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,
];
}