@@ -26,7 +26,7 @@ discard block |
||
| 26 | 26 | $id = $document->getEntityClass(); |
| 27 | 27 | $id .= '#'; |
| 28 | 28 | $entityId = $document->getEntityId(); |
| 29 | - if(is_scalar($entityId)) { |
|
| 29 | + if (is_scalar($entityId)) { |
|
| 30 | 30 | $id .= $entityId; |
| 31 | 31 | } else { |
| 32 | 32 | $id .= md5(serialize($entityId)); |
@@ -72,15 +72,15 @@ discard block |
||
| 72 | 72 | */ |
| 73 | 73 | public function autocomplete($search, $maxResults = 10) { |
| 74 | 74 | $words = array(); |
| 75 | - foreach($this->index as $doc) { |
|
| 76 | - foreach($doc->getFields() as $content) { |
|
| 77 | - if(is_string($content)) { |
|
| 75 | + foreach ($this->index as $doc) { |
|
| 76 | + foreach ($doc->getFields() as $content) { |
|
| 77 | + if (is_string($content)) { |
|
| 78 | 78 | $words = array_merge($words, explode(' ', $content)); |
| 79 | 79 | } |
| 80 | 80 | } |
| 81 | 81 | } |
| 82 | 82 | |
| 83 | - return array_filter($words, function ($word) use ($search) { |
|
| 83 | + return array_filter($words, function($word) use ($search) { |
|
| 84 | 84 | return stripos($word, $search) === 0; |
| 85 | 85 | }); |
| 86 | 86 | } |
@@ -51,7 +51,7 @@ |
||
| 51 | 51 | * |
| 52 | 52 | * @see \StingerSoft\EntitySearchBundle\Model\SearchableEntity::indexEntity() |
| 53 | 53 | */ |
| 54 | - public function indexEntity(Document &$document) { |
|
| 54 | + public function indexEntity(Document&$document) { |
|
| 55 | 55 | $document->addField(Document::FIELD_TITLE, $this->getTitle()); |
| 56 | 56 | return true; |
| 57 | 57 | } |