diff --git a/lunr.js b/lunr.js index 3c5fabaf..e5922897 100644 --- a/lunr.js +++ b/lunr.js @@ -934,7 +934,8 @@ lunr.Index.prototype.add = function (doc, emitEvent) { var fieldTokens = this.pipeline.run(lunr.tokenizer(doc[field.name])) docTokens[field.name] = fieldTokens - lunr.SortedSet.prototype.add.apply(allDocumentTokens, fieldTokens) + if(doc[field.name]) + lunr.SortedSet.prototype.add.apply(allDocumentTokens, fieldTokens) }, this) this.documentStore.set(docRef, allDocumentTokens)