You are here

public function Drupal_RichSnippets_Apachesolr_ApachesolrSchemaPreprocessor::getFieldSchemaMappings in Rich Snippets 7

Returns the entity field / Solr field mappings for all fields associated with the passed schema.

Parameters

string $schema: The schema that mappings are generated for.

Return value

array An associative array keyed by schema field name to solr field name.

1 call to Drupal_RichSnippets_Apachesolr_ApachesolrSchemaPreprocessor::getFieldSchemaMappings()
Drupal_RichSnippets_Apachesolr_ApachesolrSchemaPreprocessor::getSchemaFields in lib/Drupal/RichSnippets/Apachesolr/ApachesolrSchemaPreprocessor.php
Implements Drupal_RichSnippets_SchemaPreprocessorAbstract::getSchemaFields().

File

lib/Drupal/RichSnippets/Apachesolr/ApachesolrSchemaPreprocessor.php, line 78
Contains Drupal_RichSnippets_Apachesolr_ApachesolrSchemaPreprocessor.

Class

Drupal_RichSnippets_Apachesolr_ApachesolrSchemaPreprocessor
Rich Snippets preprocessor for the Apache Solr Search Integration module.

Code

public function getFieldSchemaMappings($schema) {
  $schema_mappings = array();

  // Check if there are any fields associated with the requested schema.
  $this->_rdfMappings = rich_snippets_get_rdf_schema_mappings($this->_entityType, $this->_bundle);
  if (!empty($this->_rdfMappings[$schema])) {

    // If so, get the Solr field name associated with the Drupal field name.
    $key_mappings = apachesolr_get_index_key_map($this->_entityType);
    foreach ($this->_rdfMappings[$schema] as $field_name) {
      if (isset($key_mappings[$field_name])) {
        $schema_mappings[$field_name] = $key_mappings[$field_name];
      }
    }
  }
  return $schema_mappings;
}