@@ -12,14 +12,14 @@ discard block |
||
12 | 12 | */ |
13 | 13 | class ResultList extends \ViewableData implements \SS_Limitable, \SS_List { |
14 | 14 | |
15 | - /** |
|
16 | - * @var \Elastica\Index |
|
17 | - */ |
|
18 | - private $service; |
|
19 | - |
|
20 | - /** |
|
21 | - * @var \Elastica\Query |
|
22 | - */ |
|
15 | + /** |
|
16 | + * @var \Elastica\Index |
|
17 | + */ |
|
18 | + private $service; |
|
19 | + |
|
20 | + /** |
|
21 | + * @var \Elastica\Query |
|
22 | + */ |
|
23 | 23 | private $query; |
24 | 24 | |
25 | 25 | /** |
@@ -310,51 +310,51 @@ discard block |
||
310 | 310 | // Safeguards against indexed items which might no longer be in the DB |
311 | 311 | if(array_key_exists($item->getId(), $retrieved[$item->getType()])) { |
312 | 312 | |
313 | - $data_object = $retrieved[$item->getType()][$item->getId()]; |
|
314 | - $data_object->setElasticaResult($item); |
|
315 | - $highlights = $item->getHighlights(); |
|
313 | + $data_object = $retrieved[$item->getType()][$item->getId()]; |
|
314 | + $data_object->setElasticaResult($item); |
|
315 | + $highlights = $item->getHighlights(); |
|
316 | 316 | |
317 | - //$snippets will contain the highlights shown in the body of the search result |
|
318 | - //$namedSnippets will be used to add highlights to the Link and Title |
|
319 | - $snippets = new \ArrayList(); |
|
320 | - $namedSnippets = new \ArrayList(); |
|
317 | + //$snippets will contain the highlights shown in the body of the search result |
|
318 | + //$namedSnippets will be used to add highlights to the Link and Title |
|
319 | + $snippets = new \ArrayList(); |
|
320 | + $namedSnippets = new \ArrayList(); |
|
321 | 321 | |
322 | - foreach(array_keys($highlights) as $fieldName) { |
|
323 | - $fieldSnippets = new \ArrayList(); |
|
322 | + foreach(array_keys($highlights) as $fieldName) { |
|
323 | + $fieldSnippets = new \ArrayList(); |
|
324 | 324 | |
325 | - foreach($highlights[$fieldName] as $snippet) { |
|
326 | - $do = new \DataObject(); |
|
327 | - $do->Snippet = $snippet; |
|
325 | + foreach($highlights[$fieldName] as $snippet) { |
|
326 | + $do = new \DataObject(); |
|
327 | + $do->Snippet = $snippet; |
|
328 | 328 | |
329 | - // skip title and link in the summary of highlights |
|
330 | - if(!in_array($fieldName, $ignore)) { |
|
331 | - $snippets->push($do); |
|
332 | - } |
|
329 | + // skip title and link in the summary of highlights |
|
330 | + if(!in_array($fieldName, $ignore)) { |
|
331 | + $snippets->push($do); |
|
332 | + } |
|
333 | 333 | |
334 | - $fieldSnippets->push($do); |
|
335 | - } |
|
334 | + $fieldSnippets->push($do); |
|
335 | + } |
|
336 | 336 | |
337 | - if($fieldSnippets->count() > 0) { |
|
338 | - //Fields may have a dot in their name, e.g. Title.standard - take this into account |
|
339 | - //As dots are an issue with template syntax, store as Title_standard |
|
340 | - $splits = explode('.', $fieldName); |
|
341 | - if(sizeof($splits) == 1) { |
|
342 | - $namedSnippets->$fieldName = $fieldSnippets; |
|
343 | - } else { |
|
344 | - // The Title.standard case, for example |
|
345 | - $splits = explode('.', $fieldName); |
|
346 | - $compositeFielddName = $splits[0] . '_' . $splits[1]; |
|
347 | - $namedSnippets->$compositeFielddName = $fieldSnippets; |
|
348 | - } |
|
337 | + if($fieldSnippets->count() > 0) { |
|
338 | + //Fields may have a dot in their name, e.g. Title.standard - take this into account |
|
339 | + //As dots are an issue with template syntax, store as Title_standard |
|
340 | + $splits = explode('.', $fieldName); |
|
341 | + if(sizeof($splits) == 1) { |
|
342 | + $namedSnippets->$fieldName = $fieldSnippets; |
|
343 | + } else { |
|
344 | + // The Title.standard case, for example |
|
345 | + $splits = explode('.', $fieldName); |
|
346 | + $compositeFielddName = $splits[0] . '_' . $splits[1]; |
|
347 | + $namedSnippets->$compositeFielddName = $fieldSnippets; |
|
348 | + } |
|
349 | 349 | |
350 | - } |
|
350 | + } |
|
351 | 351 | |
352 | 352 | |
353 | - } |
|
353 | + } |
|
354 | 354 | |
355 | 355 | |
356 | - $data_object->SearchHighlights = $snippets; |
|
357 | - $data_object->SearchHighlightsByField = $namedSnippets; |
|
356 | + $data_object->SearchHighlights = $snippets; |
|
357 | + $data_object->SearchHighlightsByField = $namedSnippets; |
|
358 | 358 | |
359 | 359 | $result[] = $data_object; |
360 | 360 |