diff --git a/ddocs/medic-db/medic-nouveau/nouveau/contacts_by_freetext/index.js b/ddocs/medic-db/medic-nouveau/nouveau/contacts_by_freetext/index.js index a322659b62..1b30c2405c 100644 --- a/ddocs/medic-db/medic-nouveau/nouveau/contacts_by_freetext/index.js +++ b/ddocs/medic-db/medic-nouveau/nouveau/contacts_by_freetext/index.js @@ -36,6 +36,11 @@ function (doc) { } }); + var dead = !!doc.date_of_death; + var muted = !!doc.muted; + var order = dead + ' ' + muted + ' ' + idx + ' ' + (doc.name && doc.name.toLowerCase()); + index('string', 'cht_sort_order', order, { store: false }); + toIndex = toIndex.trim(); if (toIndex) { index('text', 'default', toIndex, { store: true });