From c705033eca5be76a7fd3f2ed53394e9072d2cf6b Mon Sep 17 00:00:00 2001
From: Alessandro Cerioni <acerioni@grandlyon.com>
Date: Tue, 5 Mar 2019 16:12:01 +0100
Subject: [PATCH] Adding document type, according the 'type' attribut present
 in metadata.

---
 2-metadata-processor.py | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/2-metadata-processor.py b/2-metadata-processor.py
index 60473d1..3635f19 100644
--- a/2-metadata-processor.py
+++ b/2-metadata-processor.py
@@ -280,6 +280,7 @@ def process_page( channel, method, properties, body, **kwargs):
                     #featurePages = getWFS(link) #
                     full_version = metadata_record.copy() # including metadata AND data
                     full_version['uuid'] = metadata_record['metadata-fr']['geonet:info']['uuid'] + '.full'
+                    full_version['type'] = metadata_record['metadata-fr']['type']
 
                     msg = {'header': {'wfs_info': link, 'offset': 0, 'session_id': session_id, 'dest_index': dest_index}, 'body': full_version}
                     the_body = msgpack.packb(msg, use_bin_type=True)
@@ -294,6 +295,7 @@ def process_page( channel, method, properties, body, **kwargs):
 
             meta_version = metadata_record.copy() # including metadata ONLY
             meta_version['uuid'] = metadata_record['metadata-fr']['geonet:info']['uuid'] + '.meta'
+            meta_version['type'] = metadata_record['metadata-fr']['type']
 
             msg = {'header': { "index" : { "_index" : dest_index, "_type" : "_doc" } }, 'body': meta_version}
             the_body = msgpack.packb(msg, use_bin_type=True)
-- 
GitLab