equal
deleted
inserted
replaced
421 } |
421 } |
422 } |
422 } |
423 |
423 |
424 return $docList; |
424 return $docList; |
425 } |
425 } |
|
426 |
|
427 /** |
|
428 * Add country info for document. |
|
429 * This modify the document |
|
430 * |
|
431 * @param $doc the document instance |
|
432 * @return nothing |
|
433 */ |
|
434 public function addCountryInfo($doc) { |
|
435 $params = [ |
|
436 'index' => config('corpusparole.elasticsearch_index'), |
|
437 'type' => 'document', |
|
438 'id' => $doc->getId() |
|
439 ]; |
|
440 $esRes = Es::get($params); |
|
441 |
|
442 if(!empty($esRes) && $esRes['found']) { |
|
443 $source = $esRes["_source"]; |
|
444 if(array_key_exists('geonames_country', $source)) { |
|
445 $doc->setCountryCode($source['geonames_country']); |
|
446 } |
|
447 } else { |
|
448 Log::error("RdfDocumentRepository::addCountryInfo : Document ".$doc->getId()." not found in index."); |
|
449 } |
|
450 } |
|
451 |
426 } |
452 } |