You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
2 lines
23 KiB
JavaScript
2 lines
23 KiB
JavaScript
![]()
1 year ago
|
!function(){const a=function(e){var t=new a.Index;return t.pipeline.add(a.trimmer,a.stopWordFilter,a.stemmer),e&&e.call(t,t),t};var t;a.version="0.9.5",(lunr=a).utils={},a.utils.warn=(t=this,function(e){t.console&&console.warn&&console.warn(e)}),a.utils.toString=function(e){return null==e?"":e.toString()},a.EventEmitter=function(){this.events={}},a.EventEmitter.prototype.addListener=function(){const e=Array.prototype.slice.call(arguments),t=e.pop(),n=e;if("function"!=typeof t)throw new TypeError("last argument must be a function");n.forEach(function(e){this.hasHandler(e)||(this.events[e]=[]),this.events[e].push(t)},this)},a.EventEmitter.prototype.removeListener=function(e,t){this.hasHandler(e)&&-1!==(t=this.events[e].indexOf(t))&&(this.events[e].splice(t,1),0===this.events[e].length)&&delete this.events[e]},a.EventEmitter.prototype.emit=function(e){if(this.hasHandler(e)){const t=Array.prototype.slice.call(arguments,1);this.events[e].forEach(function(e){e.apply(void 0,t)},this)}},a.EventEmitter.prototype.hasHandler=function(e){return e in this.events},a.tokenizer=function(n){if(!arguments.length||null==n)return[];if(Array.isArray(n)){let e=n.filter(function(e){return null!=e}),t=(e=e.map(function(e){return a.utils.toString(e).toLowerCase()}),[]);return e.forEach(function(e){e=e.split(a.tokenizer.seperator),t=t.concat(e)},this),t}return n.toString().trim().toLowerCase().split(a.tokenizer.seperator)},a.tokenizer.defaultSeperator=/[\s-]+/,a.tokenizer.seperator=a.tokenizer.defaultSeperator,a.tokenizer.setSeperator=function(e){null!=e&&"object"==typeof e&&(a.tokenizer.seperator=e)},a.tokenizer.resetSeperator=function(){a.tokenizer.seperator=a.tokenizer.defaultSeperator},a.tokenizer.getSeperator=function(){return a.tokenizer.seperator},a.Pipeline=function(){this._queue=[]},a.Pipeline.registeredFunctions={},a.Pipeline.registerFunction=function(e,t){t in a.Pipeline.registeredFunctions&&a.utils.warn("Overwriting existing registered function: "+t),e.label=t,a.Pipeline.registeredFunctions[t]=e},a.Pipeline.getRegisteredFunction=function(e){return e in a.Pipeline.registeredFunctions!=1?null:a.Pipeline.registeredFunctions[e]},a.Pipeline.warnIfFunctionNotRegistered=function(e){e.label&&e.label in this.registeredFunctions||a.utils.warn("Function is not registered with pipeline. This may cause problems when serialising the index.\n",e)},a.Pipeline.load=function(e){const n=new a.Pipeline;return e.forEach(function(e){var t=a.Pipeline.getRegisteredFunction(e);if(!t)throw new Error("Cannot load un-registered function: "+e);n.add(t)}),n},a.Pipeline.prototype.add=function(){Array.prototype.slice.call(arguments).forEach(function(e){a.Pipeline.warnIfFunctionNotRegistered(e),this._queue.push(e)},this)},a.Pipeline.prototype.after=function(e,t){if(a.Pipeline.warnIfFunctionNotRegistered(t),-1===(e=this._queue.indexOf(e)))throw new Error("Cannot find existingFn");this._queue.splice(e+1,0,t)},a.Pipeline.prototype.before=function(e,t){if(a.Pipeline.warnIfFunctionNotRegistered(t),-1===(e=this._queue.indexOf(e)))throw new Error("Cannot find existingFn");this._queue.splice(e,0,t)},a.Pipeline.prototype.remove=function(e){-1!==(e=this._queue.indexOf(e))&&this._queue.splice(e,1)},a.Pipeline.prototype.run=function(o){var e=[],t=o.length,i=this._queue.length;for(let n=0;n<t;n++){let t=o[n];for(let e=0;e<i&&null!=(t=this._queue[e](t,n,o));e++);null!=t&&e.push(t)}return e},a.Pipeline.prototype.reset=function(){this._queue=[]},a.Pipeline.prototype.get=function(){return this._queue},a.Pipeline.prototype.toJSON=function(){return this._queue.map(function(e){return a.Pipeline.warnIfFunctionNotRegistered(e),e.label})},a.Index=function(){this._fields=[],this._ref="id",this.pipeline=new a.Pipeline,this.documentStore=new a.DocumentStore,this.index={},this.eventEmitter=new a.EventEmitter,this._idfCache={},this.on("add","remove","update",function(){this._idfCache={}}.bind(this))},a.Index.prototype.on=function(){var e=Array.prototype.slice.call(arguments);return this.eventEmitter.addListener.apply(this.eventEmitter,e)},a.Index.prototype.off=function(e,t){return this.eventEm
|