private function mapProperty(PropertyMetadata $property, $metadata)
 {
     if (false === $property->hasTag('sulu.search.field')) {
         return;
     }
     $tag = $property->getTag('sulu.search.field');
     $tagAttributes = $tag['attributes'];
     if ($metadata instanceof IndexMetadata && isset($tagAttributes['role'])) {
         switch ($tagAttributes['role']) {
             case 'title':
                 $metadata->setTitleField($this->getContentField($property));
                 $metadata->addFieldMapping($property->getName(), ['field' => $this->getContentField($property), 'type' => 'string', 'aggregate' => true, 'indexed' => false]);
                 break;
             case 'description':
                 $metadata->setDescriptionField($this->getContentField($property));
                 $metadata->addFieldMapping($property->getName(), ['field' => $this->getContentField($property), 'type' => 'string', 'aggregate' => true, 'indexed' => false]);
                 break;
             case 'image':
                 $metadata->setImageUrlField($this->getContentField($property));
                 break;
             default:
                 throw new \InvalidArgumentException(sprintf('Unknown search field role "%s", role must be one of "%s"', $tagAttributes['role'], implode(', ', ['title', 'description', 'image'])));
         }
         return;
     }
     if (!isset($tagAttributes['index']) || $tagAttributes['index'] !== 'false') {
         $metadata->addFieldMapping($property->getName(), ['type' => isset($tagAttributes['type']) ? $tagAttributes['type'] : 'string', 'field' => $this->getContentField($property), 'aggregate' => true, 'indexed' => false]);
     }
 }