@@ -29,7 +29,7 @@ discard block |
||
29 | 29 | $id = $document->getEntityClass(); |
30 | 30 | $id .= '#'; |
31 | 31 | $entityId = $document->getEntityId(); |
32 | - if(is_scalar($entityId)) { |
|
32 | + if (is_scalar($entityId)) { |
|
33 | 33 | $id .= $entityId; |
34 | 34 | } else { |
35 | 35 | $id .= md5(serialize($entityId)); |
@@ -75,15 +75,15 @@ discard block |
||
75 | 75 | */ |
76 | 76 | public function autocomplete($search, $maxResults = 10) { |
77 | 77 | $words = array(); |
78 | - foreach($this->index as $doc) { |
|
79 | - foreach($doc->getFields() as $content) { |
|
80 | - if(is_string($content)) { |
|
78 | + foreach ($this->index as $doc) { |
|
79 | + foreach ($doc->getFields() as $content) { |
|
80 | + if (is_string($content)) { |
|
81 | 81 | $words = array_merge($words, explode(' ', $content)); |
82 | 82 | } |
83 | 83 | } |
84 | 84 | } |
85 | 85 | |
86 | - return array_filter($words, function ($word) use ($search) { |
|
86 | + return array_filter($words, function($word) use ($search) { |
|
87 | 87 | return stripos($word, $search) === 0; |
88 | 88 | }); |
89 | 89 | } |
@@ -101,10 +101,10 @@ discard block |
||
101 | 101 | $facets = new FacetSetAdapter(); |
102 | 102 | |
103 | 103 | $hits = array(); |
104 | - foreach($this->index as $key => $doc) { |
|
105 | - foreach($doc->getFields() as $content) { |
|
106 | - if(is_string($content) && stripos($content, $term) !== false) { |
|
107 | - if(!isset($hits[$key])) { |
|
104 | + foreach ($this->index as $key => $doc) { |
|
105 | + foreach ($doc->getFields() as $content) { |
|
106 | + if (is_string($content) && stripos($content, $term) !== false) { |
|
107 | + if (!isset($hits[$key])) { |
|
108 | 108 | $hits[$key] = 0; |
109 | 109 | } |
110 | 110 | $hits[$key] = $hits[$key] + 1; |
@@ -113,7 +113,7 @@ discard block |
||
113 | 113 | } |
114 | 114 | arsort($hits); |
115 | 115 | $results = array(); |
116 | - foreach(array_keys($hits) as $docId) { |
|
116 | + foreach (array_keys($hits) as $docId) { |
|
117 | 117 | $doc = $this->index[$docId]; |
118 | 118 | $facets->addFacetValue(FacetSet::FACET_ENTITY_TYPE, $doc->getEntityClass()); |
119 | 119 | $facets->addFacetValue(FacetSet::FACET_AUTHOR, $doc->getFieldValue(Document::FIELD_AUTHOR)); |