diff options
Diffstat (limited to 'static/bower_components/lunr.js/lib/lunr.js')
-rw-r--r-- | static/bower_components/lunr.js/lib/lunr.js | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/static/bower_components/lunr.js/lib/lunr.js b/static/bower_components/lunr.js/lib/lunr.js new file mode 100644 index 0000000..44067da --- /dev/null +++ b/static/bower_components/lunr.js/lib/lunr.js @@ -0,0 +1,50 @@ +/** + * Convenience function for instantiating a new lunr index and configuring it + * with the default pipeline functions and the passed config function. + * + * When using this convenience function a new index will be created with the + * following functions already in the pipeline: + * + * lunr.StopWordFilter - filters out any stop words before they enter the + * index + * + * lunr.stemmer - stems the tokens before entering the index. + * + * Example: + * + * var idx = lunr(function () { + * this.field('title', 10) + * this.field('tags', 100) + * this.field('body') + * + * this.ref('cid') + * + * this.pipeline.add(function () { + * // some custom pipeline function + * }) + * + * }) + * + * @param {Function} config A function that will be called with the new instance + * of the lunr.Index as both its context and first parameter. It can be used to + * customize the instance of new lunr.Index. + * @namespace + * @module + * @returns {lunr.Index} + * + */ +var lunr = function (config) { + var idx = new lunr.Index + + idx.pipeline.add( + lunr.trimmer, + lunr.stopWordFilter, + lunr.stemmer + ) + + if (config) config.call(idx, idx) + + return idx +} + +lunr.version = "@VERSION" |