equal
deleted
inserted
replaced
98 'type' => 'string', |
98 'type' => 'string', |
99 'fields' => [ |
99 'fields' => [ |
100 'raw' => [ |
100 'raw' => [ |
101 'type' => 'string', |
101 'type' => 'string', |
102 'index' => 'not_analyzed' |
102 'index' => 'not_analyzed' |
|
103 ] |
|
104 ] |
|
105 ], |
|
106 'description' => [ |
|
107 'type' => 'string', |
|
108 'fields' => [ |
|
109 'french' => [ |
|
110 'type' => 'string', |
|
111 'analyzer' => 'french' |
103 ] |
112 ] |
104 ] |
113 ] |
105 ], |
114 ], |
106 'date' => [ 'type' => 'date', 'index' => 'not_analyzed'], |
115 'date' => [ 'type' => 'date', 'index' => 'not_analyzed'], |
107 'geonames_hierarchy' => [ 'type' => 'string', 'index' => 'not_analyzed'], |
116 'geonames_hierarchy' => [ 'type' => 'string', 'index' => 'not_analyzed'], |
522 } |
531 } |
523 return $res; |
532 return $res; |
524 }, []); |
533 }, []); |
525 } |
534 } |
526 |
535 |
|
536 private function getDescriptions($doc) { |
|
537 return array_reduce($doc->getDescriptions(), function($res, $desc) { |
|
538 $val = null; |
|
539 if(is_string($desc)) { |
|
540 $val = $desc; |
|
541 } elseif($desc instanceof Literal) { |
|
542 $val = $desc->getValue(); |
|
543 } |
|
544 if(!empty($val)) { |
|
545 array_push($res, $val); |
|
546 } |
|
547 return $res; |
|
548 }, []); |
|
549 } |
|
550 |
527 private function getDocBody($doc) { |
551 private function getDocBody($doc) { |
528 list($geonamesCountry, $geonamesHierarchy) = $this->getGeonamesHierarchy($doc); |
552 list($geonamesCountry, $geonamesHierarchy) = $this->getGeonamesHierarchy($doc); |
529 return [ |
553 return [ |
530 'title' => (string)$doc->getTitle(), |
554 'title' => (string)$doc->getTitle(), |
531 'date' => (string)$doc->getModified(), |
555 'date' => (string)$doc->getModified(), |
535 'language' => $doc->getLanguagesValue(), |
559 'language' => $doc->getLanguagesValue(), |
536 'discourse_types' => $this->getDiscourseTypes($doc), |
560 'discourse_types' => $this->getDiscourseTypes($doc), |
537 'geonames_country' => $geonamesCountry, |
561 'geonames_country' => $geonamesCountry, |
538 'geonames_hierarchy' => $geonamesHierarchy, |
562 'geonames_hierarchy' => $geonamesHierarchy, |
539 'subject' => $this->getSubjects($doc), |
563 'subject' => $this->getSubjects($doc), |
|
564 'description' => $this->getDescriptions($doc), |
540 ]; |
565 ]; |
541 } |
566 } |
542 |
567 |
543 /** |
568 /** |
544 * Index one document into Elasticsearch |
569 * Index one document into Elasticsearch |