Skip to content

Instantly share code, notes, and snippets.

@jphaas jphaas/gist:5020857
Created Feb 23, 2013

Embed
What would you like to do?
{
"main": {
"index": "function(doc) { if (doc.type == 'UserType(user)') { index('type', 'UserType(user)'); field = 'email'; data = doc[field]; try_index = function(d) { var _ref; if ((_ref = typeof d) === 'string' || _ref === 'number') { return index(field, d); } }; if ((typeof data) === 'object' && data.length) { for (_i = 0, _len = data.length; _i < _len; _i++) { d = data[_i]; try_index(d); } } else { try_index(d); } field = 'password'; data = doc[field]; try_index = function(d) { var _ref; if ((_ref = typeof d) === 'string' || _ref === 'number') { return index(field, d); } }; if ((typeof data) === 'object' && data.length) { for (_i = 0, _len = data.length; _i < _len; _i++) { d = data[_i]; try_index(d); } } else { try_index(d); } field = 'emails'; data = doc[field]; try_index = function(d) { var _ref; if ((_ref = typeof d) === 'string' || _ref === 'number') { return index(field, d); } }; if ((typeof data) === 'object' && data.length) { for (_i = 0, _len = data.length; _i < _len; _i++) { d = data[_i]; try_index(d); } } else { try_index(d); } field = 'color'; data = doc[field]; try_index = function(d) { var _ref; if ((_ref = typeof d) === 'string' || _ref === 'number') { return index(field, d); } }; if ((typeof data) === 'object' && data.length) { for (_i = 0, _len = data.length; _i < _len; _i++) { d = data[_i]; try_index(d); } } else { try_index(d); } field = 'my startups'; data = doc[field]; try_index = function(d) { var _ref; if ((_ref = typeof d) === 'string' || _ref === 'number') { return index(field, d); } }; if ((typeof data) === 'object' && data.length) { for (_i = 0, _len = data.length; _i < _len; _i++) { d = data[_i]; try_index(d); } } else { try_index(d); } field = 'Facebook'; data = doc[field]; try_index = function(d) { var _ref; if ((_ref = typeof d) === 'string' || _ref === 'number') { return index(field, d); } }; if ((typeof data) === 'object' && data.length) { for (_i = 0, _len = data.length; _i < _len; _i++) { d = data[_i]; try_index(d); } } else { try_index(d); } } }"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.