Skip to content
Snippets Groups Projects
Commit 2edea329 authored by Alessandro Cerioni's avatar Alessandro Cerioni
Browse files

Adding document type (page, post). Inserting the content coming from the CMS...

Adding document type (page, post). Inserting the content coming from the CMS into the "content-fr" attribute.
parent 421a7281
No related branches found
No related tags found
No related merge requests found
...@@ -4,7 +4,11 @@ def process_posts( posts ): ...@@ -4,7 +4,11 @@ def process_posts( posts ):
for post in posts: for post in posts:
output_post = post.copy() output_post = dict()
output_post['content-fr'] = post
output_post['uuid'] = post['uuid']
output_post['type'] = 'post'
output_posts.append(output_post) output_posts.append(output_post)
...@@ -18,7 +22,11 @@ def process_pages( pages ): ...@@ -18,7 +22,11 @@ def process_pages( pages ):
for page in pages: for page in pages:
output_page = page.copy() output_page = dict()
output_page['content-fr'] = page
output_page['uuid'] = page['uuid']
output_page['type'] = 'page'
output_pages.append(output_page) output_pages.append(output_page)
......
...@@ -81,7 +81,7 @@ def index_docs( cfg, content_type, docs ): ...@@ -81,7 +81,7 @@ def index_docs( cfg, content_type, docs ):
# #del doc['uuid'] # #del doc['uuid']
# except: # except:
# header['index']['_id'] = hashlib.md5( json.dumps(doc, sort_keys=True).encode("utf-8") ).hexdigest() # header['index']['_id'] = hashlib.md5( json.dumps(doc, sort_keys=True).encode("utf-8") ).hexdigest()
header['index']['_id'] = doc['id'] header['index']['_id'] = doc['content-fr']['id']
#print(header) #print(header)
es_body += '{0}\n{1}\n'.format(json.dumps(header), json.dumps(doc)) es_body += '{0}\n{1}\n'.format(json.dumps(header), json.dumps(doc))
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment