Skip to content

Instantly share code, notes, and snippets.

@lennart
Forked from FrancisVarga/mapfunction.js
Created November 22, 2010 17:07
Show Gist options
  • Save lennart/710266 to your computer and use it in GitHub Desktop.
Save lennart/710266 to your computer and use it in GitHub Desktop.
function(doc) {
var userID = 500;
var userTags = [
100000036,
100000065,
100000077,
100000046,
100000062,
100000103
];
if(userID != doc.userID)
{
var matchingTags = 0;
for (i in doc.userTags)
{
// Increment matching count for each matching tag
if(userTags.indexOf(doc.userTags[i]) != -1) matchingTags++;
}
emit(doc.userID,matchingTags)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment