diff --git a/ddocs/medic-db/medic-client/views/contacts_by_freetext/map.js b/ddocs/medic-db/medic-client/views/contacts_by_freetext/map.js deleted file mode 100644 index 86e0d9cbe20..00000000000 --- a/ddocs/medic-db/medic-client/views/contacts_by_freetext/map.js +++ /dev/null @@ -1,52 +0,0 @@ -function(doc) { - var skip = [ '_id', '_rev', 'type', 'refid', 'geolocation' ]; - - var usedKeys = []; - var emitMaybe = function(key, value) { - if (usedKeys.indexOf(key) === -1 && // Not already used - key.length > 2 // Not too short - ) { - usedKeys.push(key); - emit([key], value); - } - }; - - var emitField = function(key, value, order) { - if (!key || !value) { - return; - } - key = key.toLowerCase(); - if (skip.indexOf(key) !== -1 || /_date$/.test(key)) { - return; - } - if (typeof value === 'string') { - value = value.toLowerCase(); - value.split(/\s+/).forEach(function(word) { - emitMaybe(word, order); - }); - } - if (typeof value === 'number' || typeof value === 'string') { - emitMaybe(key + ':' + value, order); - } - }; - - var types = [ 'district_hospital', 'health_center', 'clinic', 'person' ]; - var idx; - if (doc.type === 'contact') { - idx = types.indexOf(doc.contact_type); - if (idx === -1) { - idx = doc.contact_type; - } - } else { - idx = types.indexOf(doc.type); - } - - if (idx !== -1) { - var dead = !!doc.date_of_death; - var muted = !!doc.muted; - var order = dead + ' ' + muted + ' ' + idx + ' ' + (doc.name && doc.name.toLowerCase()); - Object.keys(doc).forEach(function(key) { - emitField(key, doc[key], order); - }); - } -} diff --git a/ddocs/medic-db/medic-client/views/contacts_by_type_freetext/map.js b/ddocs/medic-db/medic-client/views/contacts_by_type_freetext/map.js deleted file mode 100644 index 85015e29f9d..00000000000 --- a/ddocs/medic-db/medic-client/views/contacts_by_type_freetext/map.js +++ /dev/null @@ -1,54 +0,0 @@ -function(doc) { - var skip = [ '_id', '_rev', 'type', 'refid', 'geolocation' ]; - - var usedKeys = []; - var emitMaybe = function(type, key, value) { - if (usedKeys.indexOf(key) === -1 && // Not already used - key.length > 2 // Not too short - ) { - usedKeys.push(key); - emit([ type, key ], value); - } - }; - - var emitField = function(type, key, value, order) { - if (!key || !value) { - return; - } - key = key.toLowerCase(); - if (skip.indexOf(key) !== -1 || /_date$/.test(key)) { - return; - } - if (typeof value === 'string') { - value = value.toLowerCase(); - value.split(/\s+/).forEach(function(word) { - emitMaybe(type, word, order); - }); - } - if (typeof value === 'number' || typeof value === 'string') { - emitMaybe(type, key + ':' + value, order); - } - }; - - var types = [ 'district_hospital', 'health_center', 'clinic', 'person' ]; - var idx; - var type; - if (doc.type === 'contact') { - type = doc.contact_type; - idx = types.indexOf(type); - if (idx === -1) { - idx = type; - } - } else { - type = doc.type; - idx = types.indexOf(type); - } - if (idx !== -1) { - var dead = !!doc.date_of_death; - var muted = !!doc.muted; - var order = dead + ' ' + muted + ' ' + idx + ' ' + (doc.name && doc.name.toLowerCase()); - Object.keys(doc).forEach(function(key) { - emitField(type, key, doc[key], order); - }); - } -} diff --git a/ddocs/medic-db/medic-client/views/reports_by_freetext/map.js b/ddocs/medic-db/medic-client/views/reports_by_freetext/map.js deleted file mode 100644 index 41550efee4c..00000000000 --- a/ddocs/medic-db/medic-client/views/reports_by_freetext/map.js +++ /dev/null @@ -1,46 +0,0 @@ -function(doc) { - var skip = [ '_id', '_rev', 'type', 'refid', 'content' ]; - - var usedKeys = []; - var emitMaybe = function(key, value) { - if (usedKeys.indexOf(key) === -1 && // Not already used - key.length > 2 // Not too short - ) { - usedKeys.push(key); - emit([key], value); - } - }; - - var emitField = function(key, value, reportedDate) { - if (!key || !value) { - return; - } - key = key.toLowerCase(); - if (skip.indexOf(key) !== -1 || /_date$/.test(key)) { - return; - } - if (typeof value === 'string') { - value = value.toLowerCase(); - value.split(/\s+/).forEach(function(word) { - emitMaybe(word, reportedDate); - }); - } - if (typeof value === 'number' || typeof value === 'string') { - emitMaybe(key + ':' + value, reportedDate); - } - }; - - if (doc.type === 'data_record' && doc.form) { - Object.keys(doc).forEach(function(key) { - emitField(key, doc[key], doc.reported_date); - }); - if (doc.fields) { - Object.keys(doc.fields).forEach(function(key) { - emitField(key, doc.fields[key], doc.reported_date); - }); - } - if (doc.contact && doc.contact._id) { - emitMaybe('contact:' + doc.contact._id.toLowerCase(), doc.reported_date); - } - } -}