code: function createMapFunction(fieldBoosts, index, filter, db) {
    return function (doc, emit) {
  
      if (isFiltered(doc, filter, db)) {
        return;
      }
  
      var docInfo = [];
  
      for (var i = 0, len = fieldBoosts.length; i < len; i++) {
        var fieldBoost = fieldBoosts[i];
  
        var text = getText(fieldBoost, doc);
  
        var fieldLenNorm;
        if (text) {
          var terms = getTokenStream(text, index);
          for (var j = 0, jLen = terms.length; j < jLen; j++) {
            var term = terms[j];
            // avoid emitting the value if there's only one field;
            // it takes up unnecessary space on disk
            var value = fieldBoosts.length > 1 ? i : undefined;
            emit(TYPE_TOKEN_COUNT + term, value);
          }
          fieldLenNorm = Math.sqrt(terms.length);
        } else { // no tokens
          fieldLenNorm = 0;
        }
        docInfo.push(fieldLenNorm);
      }
  
      emit(TYPE_DOC_INFO + doc._id, docInfo);
    };
  }
docs: map function that gets passed to map/reduce emits two types of key/values - one for each token and one for the field-len-norm