Beispiel #1
0
 /**
  * Returns searchable attribute by name.
  *
  * @param string $name
  * @return AttributeDescriptor|null
  */
 protected function getSearchableAttribute($name)
 {
     if ($this->_searchableAttributes === null) {
         $this->_searchableAttributes = $this->searchableType->getSearchableAttributes();
     }
     foreach ($this->_searchableAttributes as $attribute) {
         if ($attribute->name === $name) {
             return $attribute;
         }
     }
     return null;
 }
 /**
  * @param SearchableInterface $searchableType
  * @return \im\search\components\searchable\AttributeDescriptor[]
  */
 protected function getSearchableTypeMapping(SearchableInterface $searchableType)
 {
     $mapping = [];
     $type = $searchableType->getType();
     if ($searchableType instanceof IndexableInterface) {
         if (isset($this->_mapping[$type])) {
             $mapping = $this->_mapping[$type];
         } else {
             $this->_mapping[$type] = $mapping = $searchableType->getIndexMapping();
         }
     }
     return $mapping;
 }