Skip to content

Commit

Permalink
got ordering to work with the following request parameters:
Browse files Browse the repository at this point in the history
`curl -H "Content-Type: application/json" -X POST "http://admin:groot@localhost:5984/medic/_design/medic-nouveau/_nouveau/contacts_by_freetext" -d "{\"q\":\"name:asha\",\"sort\":\"-cht_sort_order\",\"limit\":50}"`
  • Loading branch information
m5r committed Nov 27, 2024
1 parent b584506 commit b04a3c4
Showing 1 changed file with 5 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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 });
Expand Down

0 comments on commit b04a3c4

Please sign in to comment.