From f4b83f5c7296a721ba452a33417f816dabe4d5b3 Mon Sep 17 00:00:00 2001
From: alex <dariasrodrig@student.unimelb.edu.au>
Date: Wed, 26 May 2021 02:41:28 +1000
Subject: [PATCH] map reduce

---
 Ansible/mapreduce.sh            |  5 +++++
 Ansible/replies.json            | 10 ++++++++++
 Ansible/retweets_followers.json | 10 ++++++++++
 Ansible/sports_by_city.json     | 10 ++++++++++
 4 files changed, 35 insertions(+)
 create mode 100644 Ansible/mapreduce.sh
 create mode 100644 Ansible/replies.json
 create mode 100644 Ansible/retweets_followers.json
 create mode 100644 Ansible/sports_by_city.json

diff --git a/Ansible/mapreduce.sh b/Ansible/mapreduce.sh
new file mode 100644
index 0000000..3e1eec1
--- /dev/null
+++ b/Ansible/mapreduce.sh
@@ -0,0 +1,5 @@
+#!/usr/bin/env bash
+
+curl -X PUT http://172.26.130.79:5984/live_demo/_design/sports_by_city --data-binary @sports_by_city.json
+curl -X PUT http://172.26.130.79:5984/live_demo/_design/retweets_followers --data-binary @retweets_followers.json
+curl -X PUT http://172.26.130.79:5984/live_demo/_design/replies --data-binary @retweets_followers.json
\ No newline at end of file
diff --git a/Ansible/replies.json b/Ansible/replies.json
new file mode 100644
index 0000000..d377a7f
--- /dev/null
+++ b/Ansible/replies.json
@@ -0,0 +1,10 @@
+{
+  "_id": "_design/replies",
+  "views": {
+    "replies": {
+      "reduce": "_count",
+      "map": "function (doc) {\n  if(doc.tags.length > 0) {\n    for (var idx in doc.tags) {\n      emit([doc.region, doc.tags[idx]],1)\n    }\n  }\n}"
+    }
+  },
+  "language": "javascript"
+}
\ No newline at end of file
diff --git a/Ansible/retweets_followers.json b/Ansible/retweets_followers.json
new file mode 100644
index 0000000..7d6c88a
--- /dev/null
+++ b/Ansible/retweets_followers.json
@@ -0,0 +1,10 @@
+{
+  "_id": "_design/retweets_followers",
+  "views": {
+    "retweets_followers": {
+      "reduce": "_stats",
+      "map": "function (doc) {\n  if(doc.tags.length > 0) {\n    for (var idx in doc.tags) {\n      emit(\n        [doc.region, doc.tags[idx]], \n        [doc.retweet_count, doc.user.followers_count]\n      )\n    }\n  }\n}"
+    }
+  },
+  "language": "javascript"
+}
\ No newline at end of file
diff --git a/Ansible/sports_by_city.json b/Ansible/sports_by_city.json
new file mode 100644
index 0000000..ba319a5
--- /dev/null
+++ b/Ansible/sports_by_city.json
@@ -0,0 +1,10 @@
+{
+  "_id": "_design/sports_by_city",
+  "views": {
+    "sports_by_city": {
+      "reduce": "_count",
+      "map": "function (doc) {\n  if(doc.tags.length > 0) {\n    for (var idx in doc.tags) {\n      emit([doc.region, doc.tags[idx]],1)\n    }\n  }\n}"
+    }
+  },
+  "language": "javascript"
+}
\ No newline at end of file
-- 
GitLab