Socket
Socket
Sign inDemoInstall

lunr

Package Overview
Dependencies
0
Maintainers
1
Versions
64
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 0.2.3 to 0.3.0

example/example_index.json

2

component.json
{
"name": "lunr.js",
"version": "0.2.3",
"version": "0.3.0",
"main": "lunr.js",

@@ -5,0 +5,0 @@ "ignore": [

@@ -19,2 +19,21 @@ /*!

/**
* Loads a previously serialised store
*
* @param {Object} serialisedData The serialised store to load.
* @returns {lunr.Store}
* @memberOf Store
*/
lunr.Store.load = function (serialisedData) {
var store = new this
store.length = serialisedData.length
store.store = Object.keys(serialisedData.store).reduce(function (memo, key) {
memo[key] = lunr.SortedSet.load(serialisedData.store[key])
return memo
}, {})
return store
}
/**
* Stores the given tokens in the store against the given id.

@@ -66,1 +85,14 @@ *

/**
* Returns a representation of the store ready for serialisation.
*
* @returns {Object}
* @memberOf Store
*/
lunr.Store.prototype.toJSON = function () {
return {
store: this.store,
length: this.length
}
}

@@ -22,3 +22,32 @@ /*!

/**
* Loads a previously serialised index.
*
* Issues a warning if the index being imported was serialised
* by a different version of lunr.
*
* @param {Object} serialisedData The serialised set to load.
* @returns {lunr.Index}
* @memberOf Index
*/
lunr.Index.load = function (serialisedData) {
if (serialisedData.version !== lunr.version && console && console.warn) {
console.warn('version mismatch: current ' + lunr.version + ' importing ' + serialisedData.version)
}
var idx = new this
idx._fields = serialisedData.fields
idx._ref = serialisedData.ref
idx.documentStore = lunr.Store.load(serialisedData.documentStore)
idx.tokenStore = lunr.TokenStore.load(serialisedData.tokenStore)
idx.corpusTokens = lunr.SortedSet.load(serialisedData.corpusTokens)
idx.pipeline = lunr.Pipeline.load(serialisedData.pipeline)
return idx
}
/**
* Adds a field to the list of fields that will be searchable within documents

@@ -270,1 +299,19 @@ * in the index.

}
/**
* Returns a representation of the index ready for serialisation.
*
* @returns {Object}
* @memberOf Index
*/
lunr.Index.prototype.toJSON = function () {
return {
version: lunr.version,
fields: this._fields,
ref: this._ref,
documentStore: this.documentStore.toJSON(),
tokenStore: this.tokenStore.toJSON(),
corpusTokens: this.corpusTokens.toJSON(),
pipeline: this.pipeline.toJSON()
}
}

@@ -25,2 +25,10 @@ /*!

*
* For serialisation of pipelines to work, all functions used in an instance of
* a pipeline should be registered with lunr.Pipeline. Registered functions can
* then be loaded. If trying to load a serialised pipeline that uses functions
* that are not registered an error will be thrown.
*
* If not planning on serialising the pipeline then registering pipeline functions
* is not necessary.
*
* @constructor

@@ -32,5 +40,73 @@ */

lunr.Pipeline.registeredFunctions = {}
/**
* Register a function with the pipeline.
*
* Functions that are used in the pipeline should be registered if the pipeline
* needs to be serialised, or a serialised pipeline needs to be loaded.
*
* Registering a function does not add it to a pipeline, functions must still be
* added to instances of the pipeline for them to be used when running a pipeline.
*
* @param {Function} fn The function to check for.
* @param {String} label The label to register this function with
* @memberOf Pipeline
*/
lunr.Pipeline.registerFunction = function (fn, label) {
if (console && console.warn && (label in this.registeredFunctions)) {
console.warn('Overwriting existing registered function: ' + label)
}
fn.label = label
lunr.Pipeline.registeredFunctions[fn.label] = fn
}
/**
* Warns if the function is not registered as a Pipeline function.
*
* @param {Function} fn The function to check for.
* @private
* @memberOf Pipeline
*/
lunr.Pipeline.warnIfFunctionNotRegistered = function (fn) {
var isRegistered = fn.label && (fn.label in this.registeredFunctions)
if (!isRegistered && console && console.warn) {
console.warn('Function is not registered with pipeline. This may cause problems when serialising the index.\n', fn)
}
}
/**
* Loads a previously serialised pipeline.
*
* All functions to be loaded must already be registered with lunr.Pipeline.
* If any function from the serialised data has not been registered then an
* error will be thrown.
*
* @param {Object} serialised The serialised pipeline to load.
* @returns {lunr.Pipeline}
* @memberOf Pipeline
*/
lunr.Pipeline.load = function (serialised) {
var pipeline = new lunr.Pipeline
serialised.forEach(function (fnName) {
var fn = lunr.Pipeline.registeredFunctions[fnName]
if (fn) {
pipeline.add(fn)
} else {
throw new Error ('Cannot load un-registered function: ' + fnName)
}
})
return pipeline
}
/**
* Adds new functions to the end of the pipeline.
*
* Logs a warning if the function has not been registered.
*
* @param {Function} functions Any number of functions to add to the pipeline.

@@ -41,3 +117,7 @@ * @memberOf Pipeline

var fns = Array.prototype.slice.call(arguments)
Array.prototype.push.apply(this._stack, fns)
fns.forEach(function (fn) {
lunr.Pipeline.warnIfFunctionNotRegistered(fn)
this._stack.push(fn)
}, this)
}

@@ -49,2 +129,4 @@

*
* Logs a warning if the function has not been registered.
*
* @param {Function} existingFn A function that already exists in the pipeline.

@@ -55,2 +137,4 @@ * @param {Function} newFn The new function to add to the pipeline.

lunr.Pipeline.prototype.after = function (existingFn, newFn) {
lunr.Pipeline.warnIfFunctionNotRegistered(newFn)
var pos = this._stack.indexOf(existingFn) + 1

@@ -64,2 +148,4 @@ this._stack.splice(pos, 0, newFn)

*
* Logs a warning if the function has not been registered.
*
* @param {Function} existingFn A function that already exists in the pipeline.

@@ -70,2 +156,4 @@ * @param {Function} newFn The new function to add to the pipeline.

lunr.Pipeline.prototype.before = function (existingFn, newFn) {
lunr.Pipeline.warnIfFunctionNotRegistered(newFn)
var pos = this._stack.indexOf(existingFn)

@@ -113,1 +201,16 @@ this._stack.splice(pos, 0, newFn)

/**
* Returns a representation of the pipeline ready for serialisation.
*
* Logs a warning if the function has not been registered.
*
* @returns {Array}
* @memberOf Pipeline
*/
lunr.Pipeline.prototype.toJSON = function () {
return this._stack.map(function (fn) {
lunr.Pipeline.warnIfFunctionNotRegistered(fn)
return fn.label
})
}

@@ -18,2 +18,18 @@ /*!

/**
* Loads a previously serialised sorted set.
*
* @param {Array} serialisedData The serialised set to load.
* @returns {lunr.SortedSet}
* @memberOf SortedSet
*/
lunr.SortedSet.load = function (serialisedData) {
var set = new this
set.elements = serialisedData
set.length = serialisedData.length
return set
}
/**
* Inserts new items into the set in the correct position to maintain the

@@ -27,3 +43,3 @@ * order.

Array.prototype.slice.call(arguments).forEach(function (element) {
if (~this.elements.indexOf(element)) return
if (~this.indexOf(element)) return
this.elements.splice(this.locationFor(element), 0, element)

@@ -78,14 +94,31 @@ }, this)

/**
* Returns the first index at which a given element can be found in the
* Returns the index at which a given element can be found in the
* sorted set, or -1 if it is not present.
*
* Delegates to Array.prototype.indexOf and has the same signature.
*
* @param {Object} elem The object to locate in the sorted set.
* @param {Number} startIndex The index at which to begin the search.
* @param {Number} start An optional index at which to start searching from
* within the set.
* @param {Number} end An optional index at which to stop search from within
* the set.
* @returns {Number}
* @memberOf SortedSet
*/
lunr.SortedSet.prototype.indexOf = function (elem, startIndex) {
return this.elements.indexOf(elem, startIndex)
lunr.SortedSet.prototype.indexOf = function (elem, start, end) {
var start = start || 0,
end = end || this.elements.length,
sectionLength = end - start,
pivot = start + Math.floor(sectionLength / 2),
pivotElem = this.elements[pivot]
if (sectionLength <= 1) {
if (pivotElem === elem) {
return pivot
} else {
return -1
}
}
if (pivotElem < elem) return this.indexOf(elem, pivot, end)
if (pivotElem > elem) return this.indexOf(elem, start, pivot)
if (pivotElem === elem) return pivot
}

@@ -199,1 +232,11 @@

}
/**
* Returns a representation of the sorted set ready for serialisation.
*
* @returns {Array}
* @memberOf SortedSet
*/
lunr.SortedSet.prototype.toJSON = function () {
return this.toArray()
}

@@ -190,1 +190,3 @@ /*!

})();
lunr.Pipeline.registerFunction(lunr.stemmer, 'stemmer')

@@ -19,125 +19,129 @@ /*!

lunr.stopWordFilter = function (token) {
var stopWords = [
"a",
"able",
"about",
"across",
"after",
"all",
"almost",
"also",
"am",
"among",
"an",
"and",
"any",
"are",
"as",
"at",
"be",
"because",
"been",
"but",
"by",
"can",
"cannot",
"could",
"dear",
"did",
"do",
"does",
"either",
"else",
"ever",
"every",
"for",
"from",
"get",
"got",
"had",
"has",
"have",
"he",
"her",
"hers",
"him",
"his",
"how",
"however",
"i",
"if",
"in",
"into",
"is",
"it",
"its",
"just",
"least",
"let",
"like",
"likely",
"may",
"me",
"might",
"most",
"must",
"my",
"neither",
"no",
"nor",
"not",
"of",
"off",
"often",
"on",
"only",
"or",
"other",
"our",
"own",
"rather",
"said",
"say",
"says",
"she",
"should",
"since",
"so",
"some",
"than",
"that",
"the",
"their",
"them",
"then",
"there",
"these",
"they",
"this",
"tis",
"to",
"too",
"twas",
"us",
"wants",
"was",
"we",
"were",
"what",
"when",
"where",
"which",
"while",
"who",
"whom",
"why",
"will",
"with",
"would",
"yet",
"you",
"your"
]
if (lunr.stopWordFilter.stopWords.indexOf(token) === -1) return token
}
if (stopWords.indexOf(token) === -1) return token
}
lunr.stopWordFilter.stopWords = new lunr.SortedSet
lunr.stopWordFilter.stopWords.length = 119
lunr.stopWordFilter.stopWords.elements = [
"a",
"able",
"about",
"across",
"after",
"all",
"almost",
"also",
"am",
"among",
"an",
"and",
"any",
"are",
"as",
"at",
"be",
"because",
"been",
"but",
"by",
"can",
"cannot",
"could",
"dear",
"did",
"do",
"does",
"either",
"else",
"ever",
"every",
"for",
"from",
"get",
"got",
"had",
"has",
"have",
"he",
"her",
"hers",
"him",
"his",
"how",
"however",
"i",
"if",
"in",
"into",
"is",
"it",
"its",
"just",
"least",
"let",
"like",
"likely",
"may",
"me",
"might",
"most",
"must",
"my",
"neither",
"no",
"nor",
"not",
"of",
"off",
"often",
"on",
"only",
"or",
"other",
"our",
"own",
"rather",
"said",
"say",
"says",
"she",
"should",
"since",
"so",
"some",
"than",
"that",
"the",
"their",
"them",
"then",
"there",
"these",
"they",
"this",
"tis",
"to",
"too",
"twas",
"us",
"wants",
"was",
"we",
"were",
"what",
"when",
"where",
"which",
"while",
"who",
"whom",
"why",
"will",
"with",
"would",
"yet",
"you",
"your"
]
lunr.Pipeline.registerFunction(lunr.stopWordFilter, 'stopWordFilter')

@@ -19,2 +19,18 @@ /*!

/**
* Loads a previously serialised token store
*
* @param {Object} serialisedData The serialised token store to load.
* @returns {lunr.TokenStore}
* @memberOf TokenStore
*/
lunr.TokenStore.load = function (serialisedData) {
var store = new this
store.root = serialisedData.root
store.length = serialisedData.length
return store
}
/**
* Adds a new token doc pair to the store.

@@ -164,1 +180,14 @@ *

/**
* Returns a representation of the token store ready for serialisation.
*
* @returns {Object}
* @memberOf TokenStore
*/
lunr.TokenStore.prototype.toJSON = function () {
return {
root: this.root,
length: this.length
}
}

@@ -17,7 +17,16 @@ /*!

var whiteSpaceSplitRegex = /\s+/
var str = str.replace(/^\s+/, '')
return str.split(whiteSpaceSplitRegex).map(function (token) {
return token.replace(/^\W+/, '').replace(/\W+$/, '').toLowerCase()
})
for (var i = str.length - 1; i >= 0; i--) {
if (/\S/.test(str.charAt(i))) {
str = str.substring(0, i + 1)
break
}
}
return str
.split(/\s+/)
.map(function (token) {
return token.replace(/^\W+/, '').replace(/\W+$/, '').toLowerCase()
})
}
/**
* lunr - http://lunrjs.com - A bit like Solr, but much smaller and not as bright - 0.2.3
* lunr - http://lunrjs.com - A bit like Solr, but much smaller and not as bright - 0.3.0
* Copyright (C) 2013 Oliver Nightingale

@@ -53,3 +53,3 @@ * MIT Licensed

lunr.version = "0.2.3"
lunr.version = "0.3.0"

@@ -75,7 +75,16 @@ if (typeof module !== 'undefined') {

var whiteSpaceSplitRegex = /\s+/
var str = str.replace(/^\s+/, '')
return str.split(whiteSpaceSplitRegex).map(function (token) {
return token.replace(/^\W+/, '').replace(/\W+$/, '').toLowerCase()
})
for (var i = str.length - 1; i >= 0; i--) {
if (/\S/.test(str.charAt(i))) {
str = str.substring(0, i + 1)
break
}
}
return str
.split(/\s+/)
.map(function (token) {
return token.replace(/^\W+/, '').replace(/\W+$/, '').toLowerCase()
})
}

@@ -106,2 +115,10 @@ /*!

*
* For serialisation of pipelines to work, all functions used in an instance of
* a pipeline should be registered with lunr.Pipeline. Registered functions can
* then be loaded. If trying to load a serialised pipeline that uses functions
* that are not registered an error will be thrown.
*
* If not planning on serialising the pipeline then registering pipeline functions
* is not necessary.
*
* @constructor

@@ -113,5 +130,73 @@ */

lunr.Pipeline.registeredFunctions = {}
/**
* Register a function with the pipeline.
*
* Functions that are used in the pipeline should be registered if the pipeline
* needs to be serialised, or a serialised pipeline needs to be loaded.
*
* Registering a function does not add it to a pipeline, functions must still be
* added to instances of the pipeline for them to be used when running a pipeline.
*
* @param {Function} fn The function to check for.
* @param {String} label The label to register this function with
* @memberOf Pipeline
*/
lunr.Pipeline.registerFunction = function (fn, label) {
if (console && console.warn && (label in this.registeredFunctions)) {
console.warn('Overwriting existing registered function: ' + label)
}
fn.label = label
lunr.Pipeline.registeredFunctions[fn.label] = fn
}
/**
* Warns if the function is not registered as a Pipeline function.
*
* @param {Function} fn The function to check for.
* @private
* @memberOf Pipeline
*/
lunr.Pipeline.warnIfFunctionNotRegistered = function (fn) {
var isRegistered = fn.label && (fn.label in this.registeredFunctions)
if (!isRegistered && console && console.warn) {
console.warn('Function is not registered with pipeline. This may cause problems when serialising the index.\n', fn)
}
}
/**
* Loads a previously serialised pipeline.
*
* All functions to be loaded must already be registered with lunr.Pipeline.
* If any function from the serialised data has not been registered then an
* error will be thrown.
*
* @param {Object} serialised The serialised pipeline to load.
* @returns {lunr.Pipeline}
* @memberOf Pipeline
*/
lunr.Pipeline.load = function (serialised) {
var pipeline = new lunr.Pipeline
serialised.forEach(function (fnName) {
var fn = lunr.Pipeline.registeredFunctions[fnName]
if (fn) {
pipeline.add(fn)
} else {
throw new Error ('Cannot load un-registered function: ' + fnName)
}
})
return pipeline
}
/**
* Adds new functions to the end of the pipeline.
*
* Logs a warning if the function has not been registered.
*
* @param {Function} functions Any number of functions to add to the pipeline.

@@ -122,3 +207,7 @@ * @memberOf Pipeline

var fns = Array.prototype.slice.call(arguments)
Array.prototype.push.apply(this._stack, fns)
fns.forEach(function (fn) {
lunr.Pipeline.warnIfFunctionNotRegistered(fn)
this._stack.push(fn)
}, this)
}

@@ -130,2 +219,4 @@

*
* Logs a warning if the function has not been registered.
*
* @param {Function} existingFn A function that already exists in the pipeline.

@@ -136,2 +227,4 @@ * @param {Function} newFn The new function to add to the pipeline.

lunr.Pipeline.prototype.after = function (existingFn, newFn) {
lunr.Pipeline.warnIfFunctionNotRegistered(newFn)
var pos = this._stack.indexOf(existingFn) + 1

@@ -145,2 +238,4 @@ this._stack.splice(pos, 0, newFn)

*
* Logs a warning if the function has not been registered.
*
* @param {Function} existingFn A function that already exists in the pipeline.

@@ -151,2 +246,4 @@ * @param {Function} newFn The new function to add to the pipeline.

lunr.Pipeline.prototype.before = function (existingFn, newFn) {
lunr.Pipeline.warnIfFunctionNotRegistered(newFn)
var pos = this._stack.indexOf(existingFn)

@@ -194,2 +291,17 @@ this._stack.splice(pos, 0, newFn)

/**
* Returns a representation of the pipeline ready for serialisation.
*
* Logs a warning if the function has not been registered.
*
* @returns {Array}
* @memberOf Pipeline
*/
lunr.Pipeline.prototype.toJSON = function () {
return this._stack.map(function (fn) {
lunr.Pipeline.warnIfFunctionNotRegistered(fn)
return fn.label
})
}
/*!

@@ -296,2 +408,18 @@ * lunr.Vector

/**
* Loads a previously serialised sorted set.
*
* @param {Array} serialisedData The serialised set to load.
* @returns {lunr.SortedSet}
* @memberOf SortedSet
*/
lunr.SortedSet.load = function (serialisedData) {
var set = new this
set.elements = serialisedData
set.length = serialisedData.length
return set
}
/**
* Inserts new items into the set in the correct position to maintain the

@@ -305,3 +433,3 @@ * order.

Array.prototype.slice.call(arguments).forEach(function (element) {
if (~this.elements.indexOf(element)) return
if (~this.indexOf(element)) return
this.elements.splice(this.locationFor(element), 0, element)

@@ -356,14 +484,31 @@ }, this)

/**
* Returns the first index at which a given element can be found in the
* Returns the index at which a given element can be found in the
* sorted set, or -1 if it is not present.
*
* Delegates to Array.prototype.indexOf and has the same signature.
*
* @param {Object} elem The object to locate in the sorted set.
* @param {Number} startIndex The index at which to begin the search.
* @param {Number} start An optional index at which to start searching from
* within the set.
* @param {Number} end An optional index at which to stop search from within
* the set.
* @returns {Number}
* @memberOf SortedSet
*/
lunr.SortedSet.prototype.indexOf = function (elem, startIndex) {
return this.elements.indexOf(elem, startIndex)
lunr.SortedSet.prototype.indexOf = function (elem, start, end) {
var start = start || 0,
end = end || this.elements.length,
sectionLength = end - start,
pivot = start + Math.floor(sectionLength / 2),
pivotElem = this.elements[pivot]
if (sectionLength <= 1) {
if (pivotElem === elem) {
return pivot
} else {
return -1
}
}
if (pivotElem < elem) return this.indexOf(elem, pivot, end)
if (pivotElem > elem) return this.indexOf(elem, start, pivot)
if (pivotElem === elem) return pivot
}

@@ -477,2 +622,12 @@

}
/**
* Returns a representation of the sorted set ready for serialisation.
*
* @returns {Array}
* @memberOf SortedSet
*/
lunr.SortedSet.prototype.toJSON = function () {
return this.toArray()
}
/*!

@@ -499,3 +654,32 @@ * lunr.Index

/**
* Loads a previously serialised index.
*
* Issues a warning if the index being imported was serialised
* by a different version of lunr.
*
* @param {Object} serialisedData The serialised set to load.
* @returns {lunr.Index}
* @memberOf Index
*/
lunr.Index.load = function (serialisedData) {
if (serialisedData.version !== lunr.version && console && console.warn) {
console.warn('version mismatch: current ' + lunr.version + ' importing ' + serialisedData.version)
}
var idx = new this
idx._fields = serialisedData.fields
idx._ref = serialisedData.ref
idx.documentStore = lunr.Store.load(serialisedData.documentStore)
idx.tokenStore = lunr.TokenStore.load(serialisedData.tokenStore)
idx.corpusTokens = lunr.SortedSet.load(serialisedData.corpusTokens)
idx.pipeline = lunr.Pipeline.load(serialisedData.pipeline)
return idx
}
/**
* Adds a field to the list of fields that will be searchable within documents

@@ -747,2 +931,20 @@ * in the index.

}
/**
* Returns a representation of the index ready for serialisation.
*
* @returns {Object}
* @memberOf Index
*/
lunr.Index.prototype.toJSON = function () {
return {
version: lunr.version,
fields: this._fields,
ref: this._ref,
documentStore: this.documentStore.toJSON(),
tokenStore: this.tokenStore.toJSON(),
corpusTokens: this.corpusTokens.toJSON(),
pipeline: this.pipeline.toJSON()
}
}
/*!

@@ -766,2 +968,21 @@ * lunr.Store

/**
* Loads a previously serialised store
*
* @param {Object} serialisedData The serialised store to load.
* @returns {lunr.Store}
* @memberOf Store
*/
lunr.Store.load = function (serialisedData) {
var store = new this
store.length = serialisedData.length
store.store = Object.keys(serialisedData.store).reduce(function (memo, key) {
memo[key] = lunr.SortedSet.load(serialisedData.store[key])
return memo
}, {})
return store
}
/**
* Stores the given tokens in the store against the given id.

@@ -813,2 +1034,15 @@ *

/**
* Returns a representation of the store ready for serialisation.
*
* @returns {Object}
* @memberOf Store
*/
lunr.Store.prototype.toJSON = function () {
return {
store: this.store,
length: this.length
}
}
/*!

@@ -1003,2 +1237,4 @@ * lunr.stemmer

})();
lunr.Pipeline.registerFunction(lunr.stemmer, 'stemmer')
/*!

@@ -1022,126 +1258,130 @@ * lunr.stopWordFilter

lunr.stopWordFilter = function (token) {
var stopWords = [
"a",
"able",
"about",
"across",
"after",
"all",
"almost",
"also",
"am",
"among",
"an",
"and",
"any",
"are",
"as",
"at",
"be",
"because",
"been",
"but",
"by",
"can",
"cannot",
"could",
"dear",
"did",
"do",
"does",
"either",
"else",
"ever",
"every",
"for",
"from",
"get",
"got",
"had",
"has",
"have",
"he",
"her",
"hers",
"him",
"his",
"how",
"however",
"i",
"if",
"in",
"into",
"is",
"it",
"its",
"just",
"least",
"let",
"like",
"likely",
"may",
"me",
"might",
"most",
"must",
"my",
"neither",
"no",
"nor",
"not",
"of",
"off",
"often",
"on",
"only",
"or",
"other",
"our",
"own",
"rather",
"said",
"say",
"says",
"she",
"should",
"since",
"so",
"some",
"than",
"that",
"the",
"their",
"them",
"then",
"there",
"these",
"they",
"this",
"tis",
"to",
"too",
"twas",
"us",
"wants",
"was",
"we",
"were",
"what",
"when",
"where",
"which",
"while",
"who",
"whom",
"why",
"will",
"with",
"would",
"yet",
"you",
"your"
]
if (lunr.stopWordFilter.stopWords.indexOf(token) === -1) return token
}
if (stopWords.indexOf(token) === -1) return token
}
lunr.stopWordFilter.stopWords = new lunr.SortedSet
lunr.stopWordFilter.stopWords.length = 119
lunr.stopWordFilter.stopWords.elements = [
"a",
"able",
"about",
"across",
"after",
"all",
"almost",
"also",
"am",
"among",
"an",
"and",
"any",
"are",
"as",
"at",
"be",
"because",
"been",
"but",
"by",
"can",
"cannot",
"could",
"dear",
"did",
"do",
"does",
"either",
"else",
"ever",
"every",
"for",
"from",
"get",
"got",
"had",
"has",
"have",
"he",
"her",
"hers",
"him",
"his",
"how",
"however",
"i",
"if",
"in",
"into",
"is",
"it",
"its",
"just",
"least",
"let",
"like",
"likely",
"may",
"me",
"might",
"most",
"must",
"my",
"neither",
"no",
"nor",
"not",
"of",
"off",
"often",
"on",
"only",
"or",
"other",
"our",
"own",
"rather",
"said",
"say",
"says",
"she",
"should",
"since",
"so",
"some",
"than",
"that",
"the",
"their",
"them",
"then",
"there",
"these",
"they",
"this",
"tis",
"to",
"too",
"twas",
"us",
"wants",
"was",
"we",
"were",
"what",
"when",
"where",
"which",
"while",
"who",
"whom",
"why",
"will",
"with",
"would",
"yet",
"you",
"your"
]
lunr.Pipeline.registerFunction(lunr.stopWordFilter, 'stopWordFilter')
/*!

@@ -1165,2 +1405,18 @@ * lunr.stemmer

/**
* Loads a previously serialised token store
*
* @param {Object} serialisedData The serialised token store to load.
* @returns {lunr.TokenStore}
* @memberOf TokenStore
*/
lunr.TokenStore.load = function (serialisedData) {
var store = new this
store.root = serialisedData.root
store.length = serialisedData.length
return store
}
/**
* Adds a new token doc pair to the store.

@@ -1310,1 +1566,14 @@ *

/**
* Returns a representation of the token store ready for serialisation.
*
* @returns {Object}
* @memberOf TokenStore
*/
lunr.TokenStore.prototype.toJSON = function () {
return {
root: this.root,
length: this.length
}
}
/**
* lunr - http://lunrjs.com - A bit like Solr, but much smaller and not as bright - 0.2.3
* lunr - http://lunrjs.com - A bit like Solr, but much smaller and not as bright - 0.3.0
* Copyright (C) 2013 Oliver Nightingale

@@ -7,2 +7,2 @@ * MIT Licensed

*/
var lunr=function(e){var t=new lunr.Index;return t.pipeline.add(lunr.stopWordFilter,lunr.stemmer),e&&e.call(t,t),t};lunr.version="0.2.3","undefined"!=typeof module&&(module.exports=lunr),lunr.tokenizer=function(e){if(Array.isArray(e))return e;var t=/\s+/;return e.split(t).map(function(e){return e.replace(/^\W+/,"").replace(/\W+$/,"").toLowerCase()})},lunr.Pipeline=function(){this._stack=[]},lunr.Pipeline.prototype.add=function(){var e=Array.prototype.slice.call(arguments);Array.prototype.push.apply(this._stack,e)},lunr.Pipeline.prototype.after=function(e,t){var n=this._stack.indexOf(e)+1;this._stack.splice(n,0,t)},lunr.Pipeline.prototype.before=function(e,t){var n=this._stack.indexOf(e);this._stack.splice(n,0,t)},lunr.Pipeline.prototype.remove=function(e){var t=this._stack.indexOf(e);this._stack.splice(t,1)},lunr.Pipeline.prototype.run=function(e){for(var t=[],n=e.length,r=this._stack.length,o=0;n>o;o++){for(var i=e[o],s=0;r>s&&(i=this._stack[s](i,o,e),void 0!==i);s++);void 0!==i&&t.push(i)}return t},lunr.Vector=function(e){this.elements=e;for(var t=0;e.length>t;t++)t in this.elements||(this.elements[t]=0)},lunr.Vector.prototype.magnitude=function(){if(this._magnitude)return this._magnitude;for(var e,t=0,n=this.elements,r=n.length,o=0;r>o;o++)e=n[o],t+=e*e;return this._magnitude=Math.sqrt(t)},lunr.Vector.prototype.dot=function(e){for(var t=this.elements,n=e.elements,r=t.length,o=0,i=0;r>i;i++)o+=t[i]*n[i];return o},lunr.Vector.prototype.similarity=function(e){return this.dot(e)/(this.magnitude()*e.magnitude())},lunr.Vector.prototype.toArray=function(){return this.elements},lunr.SortedSet=function(){this.length=0,this.elements=[]},lunr.SortedSet.prototype.add=function(){Array.prototype.slice.call(arguments).forEach(function(e){~this.elements.indexOf(e)||this.elements.splice(this.locationFor(e),0,e)},this),this.length=this.elements.length},lunr.SortedSet.prototype.toArray=function(){return this.elements.slice()},lunr.SortedSet.prototype.map=function(e,t){return this.elements.map(e,t)},lunr.SortedSet.prototype.forEach=function(e,t){return this.elements.forEach(e,t)},lunr.SortedSet.prototype.indexOf=function(e,t){return this.elements.indexOf(e,t)},lunr.SortedSet.prototype.locationFor=function(e,t,n){var t=t||0,n=n||this.elements.length,r=n-t,o=t+Math.floor(r/2),i=this.elements[o];if(1>=r){if(i>e)return o;if(e>i)return o+1}return e>i?this.locationFor(e,o,n):i>e?this.locationFor(e,t,o):void 0},lunr.SortedSet.prototype.intersect=function(e){for(var t=new lunr.SortedSet,n=0,r=0,o=this.length,i=e.length,s=this.elements,l=e.elements;;){if(n>o-1||r>i-1)break;s[n]!==l[r]?s[n]<l[r]?n++:s[n]>l[r]&&r++:(t.add(s[n]),n++,r++)}return t},lunr.SortedSet.prototype.clone=function(){var e=new lunr.SortedSet;return e.elements=this.toArray(),e.length=e.elements.length,e},lunr.SortedSet.prototype.union=function(e){var t,n,r;return this.length>=e.length?(t=this,n=e):(t=e,n=this),r=t.clone(),r.add.apply(r,n.toArray()),r},lunr.Index=function(){this._fields=[],this._ref="id",this.pipeline=new lunr.Pipeline,this.documentStore=new lunr.Store,this.tokenStore=new lunr.TokenStore,this.corpusTokens=new lunr.SortedSet},lunr.Index.prototype.field=function(e,t){var t=t||{},n={name:e,boost:t.boost||1};return this._fields.push(n),this},lunr.Index.prototype.ref=function(e){return this._ref=e,this},lunr.Index.prototype.add=function(e){var t={},n=new lunr.SortedSet,r=e[this._ref];this._fields.forEach(function(r){var o=this.pipeline.run(lunr.tokenizer(e[r.name]));t[r.name]=o,lunr.SortedSet.prototype.add.apply(n,o)},this),this.documentStore.set(r,n),lunr.SortedSet.prototype.add.apply(this.corpusTokens,n.toArray());for(var o=0;n.length>o;o++){var i=n.elements[o],s=this._fields.reduce(function(e,n){var r=t[n.name].filter(function(e){return e===i}).length,o=t[n.name].length;return e+r/o*n.boost},0);this.tokenStore.add(i,{ref:r,tf:s})}},lunr.Index.prototype.remove=function(e){var t=e[this._ref],n=this.documentStore.get(t);this.documentStore.remove(t),n.forEach(function(e){this.tokenStore.remove(e,t)},this)},lunr.Index.prototype.update=function(e){this.remove(e),this.add(e)},lunr.Index.prototype.idf=function(e){var t=Object.keys(this.tokenStore.get(e)).length;return 0===t?1:1+Math.log(this.tokenStore.length/t)},lunr.Index.prototype.search=function(e){var t=this.pipeline.run(lunr.tokenizer(e)),n=Array(this.corpusTokens.length),r=[],o=this._fields.reduce(function(e,t){return e+t.boost},0),i=t.some(function(e){return this.tokenStore.has(e)},this);if(!i)return[];t.forEach(function(e,t,i){var s=1/i.length*this._fields.length*o,l=this,u=this.tokenStore.expand(e).reduce(function(t,r){var o=l.corpusTokens.indexOf(r),i=l.idf(r),u=r===e?10:1,a=new lunr.SortedSet;return o>-1&&(n[o]=s*i*u),Object.keys(l.tokenStore.get(r)).forEach(function(e){a.add(e)}),t.union(a)},new lunr.SortedSet);r.push(u)},this);var s=r.reduce(function(e,t){return e.intersect(t)}),l=new lunr.Vector(n);return s.map(function(e){return{ref:e,score:l.similarity(this.documentVector(e))}},this).sort(function(e,t){return t.score-e.score})},lunr.Index.prototype.documentVector=function(e){for(var t=this.documentStore.get(e),n=t.length,r=Array(this.corpusTokens.length),o=0;n>o;o++){var i=t.elements[o],s=this.tokenStore.get(i)[e].tf,l=this.idf(i);r[this.corpusTokens.indexOf(i)]=s*l}return new lunr.Vector(r)},lunr.Store=function(){this.store={},this.length=0},lunr.Store.prototype.set=function(e,t){this.store[e]=t,this.length=Object.keys(this.store).length},lunr.Store.prototype.get=function(e){return this.store[e]},lunr.Store.prototype.has=function(e){return e in this.store},lunr.Store.prototype.remove=function(e){this.has(e)&&(delete this.store[e],this.length--)},lunr.stemmer=function(){var e={ational:"ate",tional:"tion",enci:"ence",anci:"ance",izer:"ize",bli:"ble",alli:"al",entli:"ent",eli:"e",ousli:"ous",ization:"ize",ation:"ate",ator:"ate",alism:"al",iveness:"ive",fulness:"ful",ousness:"ous",aliti:"al",iviti:"ive",biliti:"ble",logi:"log"},t={icate:"ic",ative:"",alize:"al",iciti:"ic",ical:"ic",ful:"",ness:""},n="[^aeiou]",r="[aeiouy]",o=n+"[^aeiouy]*",i=r+"[aeiou]*",s="^("+o+")?"+i+o,l="^("+o+")?"+i+o+"("+i+")?$",u="^("+o+")?"+i+o+i+o,a="^("+o+")?"+r;return function(n){var i,h,c,p,f,d,y;if(3>n.length)return n;if(c=n.substr(0,1),"y"==c&&(n=c.toUpperCase()+n.substr(1)),p=/^(.+?)(ss|i)es$/,f=/^(.+?)([^s])s$/,p.test(n)?n=n.replace(p,"$1$2"):f.test(n)&&(n=n.replace(f,"$1$2")),p=/^(.+?)eed$/,f=/^(.+?)(ed|ing)$/,p.test(n)){var m=p.exec(n);p=RegExp(s),p.test(m[1])&&(p=/.$/,n=n.replace(p,""))}else if(f.test(n)){var m=f.exec(n);i=m[1],f=RegExp(a),f.test(i)&&(n=i,f=/(at|bl|iz)$/,d=RegExp("([^aeiouylsz])\\1$"),y=RegExp("^"+o+r+"[^aeiouwxy]$"),f.test(n)?n+="e":d.test(n)?(p=/.$/,n=n.replace(p,"")):y.test(n)&&(n+="e"))}if(p=/^(.+?)y$/,p.test(n)){var m=p.exec(n);i=m[1],p=RegExp(a),p.test(i)&&(n=i+"i")}if(p=/^(.+?)(ational|tional|enci|anci|izer|bli|alli|entli|eli|ousli|ization|ation|ator|alism|iveness|fulness|ousness|aliti|iviti|biliti|logi)$/,p.test(n)){var m=p.exec(n);i=m[1],h=m[2],p=RegExp(s),p.test(i)&&(n=i+e[h])}if(p=/^(.+?)(icate|ative|alize|iciti|ical|ful|ness)$/,p.test(n)){var m=p.exec(n);i=m[1],h=m[2],p=RegExp(s),p.test(i)&&(n=i+t[h])}if(p=/^(.+?)(al|ance|ence|er|ic|able|ible|ant|ement|ment|ent|ou|ism|ate|iti|ous|ive|ize)$/,f=/^(.+?)(s|t)(ion)$/,p.test(n)){var m=p.exec(n);i=m[1],p=RegExp(u),p.test(i)&&(n=i)}else if(f.test(n)){var m=f.exec(n);i=m[1]+m[2],f=RegExp(u),f.test(i)&&(n=i)}if(p=/^(.+?)e$/,p.test(n)){var m=p.exec(n);i=m[1],p=RegExp(u),f=RegExp(l),d=RegExp("^"+o+r+"[^aeiouwxy]$"),(p.test(i)||f.test(i)&&!d.test(i))&&(n=i)}return p=/ll$/,f=RegExp(u),p.test(n)&&f.test(n)&&(p=/.$/,n=n.replace(p,"")),"y"==c&&(n=c.toLowerCase()+n.substr(1)),n}}(),lunr.stopWordFilter=function(e){var t=["a","able","about","across","after","all","almost","also","am","among","an","and","any","are","as","at","be","because","been","but","by","can","cannot","could","dear","did","do","does","either","else","ever","every","for","from","get","got","had","has","have","he","her","hers","him","his","how","however","i","if","in","into","is","it","its","just","least","let","like","likely","may","me","might","most","must","my","neither","no","nor","not","of","off","often","on","only","or","other","our","own","rather","said","say","says","she","should","since","so","some","than","that","the","their","them","then","there","these","they","this","tis","to","too","twas","us","wants","was","we","were","what","when","where","which","while","who","whom","why","will","with","would","yet","you","your"];return-1===t.indexOf(e)?e:void 0},lunr.TokenStore=function(){this.root={docs:{}},this.length=0},lunr.TokenStore.prototype.add=function(e,t,n){var n=n||this.root,r=e[0],o=e.slice(1);return r in n||(n[r]={docs:{}}),0===o.length?(n[r].docs[t.ref]=t,this.length+=1,void 0):this.add(o,t,n[r])},lunr.TokenStore.prototype.has=function(e,t){var t=t||this.root,n=e[0],r=e.slice(1);return n in t?0===r.length?!0:this.has(r,t[n]):!1},lunr.TokenStore.prototype.getNode=function(e,t){var t=t||this.root,n=e[0],r=e.slice(1);return n in t?0===r.length?t[n]:this.getNode(r,t[n]):{}},lunr.TokenStore.prototype.get=function(e,t){return this.getNode(e,t).docs||{}},lunr.TokenStore.prototype.remove=function(e,t,n){var n=n||this.root,r=e[0],o=e.slice(1);if(r in n)return 0!==o.length?this.remove(o,t,n[r]):(delete n[r].docs[t],void 0)},lunr.TokenStore.prototype.expand=function(e,t){var n=this.getNode(e),r=n.docs||{},t=t||[];return Object.keys(r).length&&t.push(e),Object.keys(n).forEach(function(n){"docs"!==n&&t.concat(this.expand(e+n,t))},this),t};
var lunr=function(e){var t=new lunr.Index;return t.pipeline.add(lunr.stopWordFilter,lunr.stemmer),e&&e.call(t,t),t};lunr.version="0.3.0","undefined"!=typeof module&&(module.exports=lunr),lunr.tokenizer=function(e){if(Array.isArray(e))return e;for(var e=e.replace(/^\s+/,""),t=e.length-1;t>=0;t--)if(/\S/.test(e.charAt(t))){e=e.substring(0,t+1);break}return e.split(/\s+/).map(function(e){return e.replace(/^\W+/,"").replace(/\W+$/,"").toLowerCase()})},lunr.Pipeline=function(){this._stack=[]},lunr.Pipeline.registeredFunctions={},lunr.Pipeline.registerFunction=function(e,t){console&&console.warn&&t in this.registeredFunctions&&console.warn("Overwriting existing registered function: "+t),e.label=t,lunr.Pipeline.registeredFunctions[e.label]=e},lunr.Pipeline.warnIfFunctionNotRegistered=function(e){var t=e.label&&e.label in this.registeredFunctions;!t&&console&&console.warn&&console.warn("Function is not registered with pipeline. This may cause problems when serialising the index.\n",e)},lunr.Pipeline.load=function(e){var t=new lunr.Pipeline;return e.forEach(function(e){var n=lunr.Pipeline.registeredFunctions[e];if(!n)throw Error("Cannot load un-registered function: "+e);t.add(n)}),t},lunr.Pipeline.prototype.add=function(){var e=Array.prototype.slice.call(arguments);e.forEach(function(e){lunr.Pipeline.warnIfFunctionNotRegistered(e),this._stack.push(e)},this)},lunr.Pipeline.prototype.after=function(e,t){lunr.Pipeline.warnIfFunctionNotRegistered(t);var n=this._stack.indexOf(e)+1;this._stack.splice(n,0,t)},lunr.Pipeline.prototype.before=function(e,t){lunr.Pipeline.warnIfFunctionNotRegistered(t);var n=this._stack.indexOf(e);this._stack.splice(n,0,t)},lunr.Pipeline.prototype.remove=function(e){var t=this._stack.indexOf(e);this._stack.splice(t,1)},lunr.Pipeline.prototype.run=function(e){for(var t=[],n=e.length,r=this._stack.length,o=0;n>o;o++){for(var i=e[o],s=0;r>s&&(i=this._stack[s](i,o,e),void 0!==i);s++);void 0!==i&&t.push(i)}return t},lunr.Pipeline.prototype.toJSON=function(){return this._stack.map(function(e){return lunr.Pipeline.warnIfFunctionNotRegistered(e),e.label})},lunr.Vector=function(e){this.elements=e;for(var t=0;e.length>t;t++)t in this.elements||(this.elements[t]=0)},lunr.Vector.prototype.magnitude=function(){if(this._magnitude)return this._magnitude;for(var e,t=0,n=this.elements,r=n.length,o=0;r>o;o++)e=n[o],t+=e*e;return this._magnitude=Math.sqrt(t)},lunr.Vector.prototype.dot=function(e){for(var t=this.elements,n=e.elements,r=t.length,o=0,i=0;r>i;i++)o+=t[i]*n[i];return o},lunr.Vector.prototype.similarity=function(e){return this.dot(e)/(this.magnitude()*e.magnitude())},lunr.Vector.prototype.toArray=function(){return this.elements},lunr.SortedSet=function(){this.length=0,this.elements=[]},lunr.SortedSet.load=function(e){var t=new this;return t.elements=e,t.length=e.length,t},lunr.SortedSet.prototype.add=function(){Array.prototype.slice.call(arguments).forEach(function(e){~this.indexOf(e)||this.elements.splice(this.locationFor(e),0,e)},this),this.length=this.elements.length},lunr.SortedSet.prototype.toArray=function(){return this.elements.slice()},lunr.SortedSet.prototype.map=function(e,t){return this.elements.map(e,t)},lunr.SortedSet.prototype.forEach=function(e,t){return this.elements.forEach(e,t)},lunr.SortedSet.prototype.indexOf=function(e,t,n){var t=t||0,n=n||this.elements.length,r=n-t,o=t+Math.floor(r/2),i=this.elements[o];return 1>=r?i===e?o:-1:e>i?this.indexOf(e,o,n):i>e?this.indexOf(e,t,o):i===e?o:void 0},lunr.SortedSet.prototype.locationFor=function(e,t,n){var t=t||0,n=n||this.elements.length,r=n-t,o=t+Math.floor(r/2),i=this.elements[o];if(1>=r){if(i>e)return o;if(e>i)return o+1}return e>i?this.locationFor(e,o,n):i>e?this.locationFor(e,t,o):void 0},lunr.SortedSet.prototype.intersect=function(e){for(var t=new lunr.SortedSet,n=0,r=0,o=this.length,i=e.length,s=this.elements,l=e.elements;;){if(n>o-1||r>i-1)break;s[n]!==l[r]?s[n]<l[r]?n++:s[n]>l[r]&&r++:(t.add(s[n]),n++,r++)}return t},lunr.SortedSet.prototype.clone=function(){var e=new lunr.SortedSet;return e.elements=this.toArray(),e.length=e.elements.length,e},lunr.SortedSet.prototype.union=function(e){var t,n,r;return this.length>=e.length?(t=this,n=e):(t=e,n=this),r=t.clone(),r.add.apply(r,n.toArray()),r},lunr.SortedSet.prototype.toJSON=function(){return this.toArray()},lunr.Index=function(){this._fields=[],this._ref="id",this.pipeline=new lunr.Pipeline,this.documentStore=new lunr.Store,this.tokenStore=new lunr.TokenStore,this.corpusTokens=new lunr.SortedSet},lunr.Index.load=function(e){e.version!==lunr.version&&console&&console.warn&&console.warn("version mismatch: current "+lunr.version+" importing "+e.version);var t=new this;return t._fields=e.fields,t._ref=e.ref,t.documentStore=lunr.Store.load(e.documentStore),t.tokenStore=lunr.TokenStore.load(e.tokenStore),t.corpusTokens=lunr.SortedSet.load(e.corpusTokens),t.pipeline=lunr.Pipeline.load(e.pipeline),t},lunr.Index.prototype.field=function(e,t){var t=t||{},n={name:e,boost:t.boost||1};return this._fields.push(n),this},lunr.Index.prototype.ref=function(e){return this._ref=e,this},lunr.Index.prototype.add=function(e){var t={},n=new lunr.SortedSet,r=e[this._ref];this._fields.forEach(function(r){var o=this.pipeline.run(lunr.tokenizer(e[r.name]));t[r.name]=o,lunr.SortedSet.prototype.add.apply(n,o)},this),this.documentStore.set(r,n),lunr.SortedSet.prototype.add.apply(this.corpusTokens,n.toArray());for(var o=0;n.length>o;o++){var i=n.elements[o],s=this._fields.reduce(function(e,n){var r=t[n.name].filter(function(e){return e===i}).length,o=t[n.name].length;return e+r/o*n.boost},0);this.tokenStore.add(i,{ref:r,tf:s})}},lunr.Index.prototype.remove=function(e){var t=e[this._ref],n=this.documentStore.get(t);this.documentStore.remove(t),n.forEach(function(e){this.tokenStore.remove(e,t)},this)},lunr.Index.prototype.update=function(e){this.remove(e),this.add(e)},lunr.Index.prototype.idf=function(e){var t=Object.keys(this.tokenStore.get(e)).length;return 0===t?1:1+Math.log(this.tokenStore.length/t)},lunr.Index.prototype.search=function(e){var t=this.pipeline.run(lunr.tokenizer(e)),n=Array(this.corpusTokens.length),r=[],o=this._fields.reduce(function(e,t){return e+t.boost},0),i=t.some(function(e){return this.tokenStore.has(e)},this);if(!i)return[];t.forEach(function(e,t,i){var s=1/i.length*this._fields.length*o,l=this,u=this.tokenStore.expand(e).reduce(function(t,r){var o=l.corpusTokens.indexOf(r),i=l.idf(r),u=r===e?10:1,a=new lunr.SortedSet;return o>-1&&(n[o]=s*i*u),Object.keys(l.tokenStore.get(r)).forEach(function(e){a.add(e)}),t.union(a)},new lunr.SortedSet);r.push(u)},this);var s=r.reduce(function(e,t){return e.intersect(t)}),l=new lunr.Vector(n);return s.map(function(e){return{ref:e,score:l.similarity(this.documentVector(e))}},this).sort(function(e,t){return t.score-e.score})},lunr.Index.prototype.documentVector=function(e){for(var t=this.documentStore.get(e),n=t.length,r=Array(this.corpusTokens.length),o=0;n>o;o++){var i=t.elements[o],s=this.tokenStore.get(i)[e].tf,l=this.idf(i);r[this.corpusTokens.indexOf(i)]=s*l}return new lunr.Vector(r)},lunr.Index.prototype.toJSON=function(){return{version:lunr.version,fields:this._fields,ref:this._ref,documentStore:this.documentStore.toJSON(),tokenStore:this.tokenStore.toJSON(),corpusTokens:this.corpusTokens.toJSON(),pipeline:this.pipeline.toJSON()}},lunr.Store=function(){this.store={},this.length=0},lunr.Store.load=function(e){var t=new this;return t.length=e.length,t.store=Object.keys(e.store).reduce(function(t,n){return t[n]=lunr.SortedSet.load(e.store[n]),t},{}),t},lunr.Store.prototype.set=function(e,t){this.store[e]=t,this.length=Object.keys(this.store).length},lunr.Store.prototype.get=function(e){return this.store[e]},lunr.Store.prototype.has=function(e){return e in this.store},lunr.Store.prototype.remove=function(e){this.has(e)&&(delete this.store[e],this.length--)},lunr.Store.prototype.toJSON=function(){return{store:this.store,length:this.length}},lunr.stemmer=function(){var e={ational:"ate",tional:"tion",enci:"ence",anci:"ance",izer:"ize",bli:"ble",alli:"al",entli:"ent",eli:"e",ousli:"ous",ization:"ize",ation:"ate",ator:"ate",alism:"al",iveness:"ive",fulness:"ful",ousness:"ous",aliti:"al",iviti:"ive",biliti:"ble",logi:"log"},t={icate:"ic",ative:"",alize:"al",iciti:"ic",ical:"ic",ful:"",ness:""},n="[^aeiou]",r="[aeiouy]",o=n+"[^aeiouy]*",i=r+"[aeiou]*",s="^("+o+")?"+i+o,l="^("+o+")?"+i+o+"("+i+")?$",u="^("+o+")?"+i+o+i+o,a="^("+o+")?"+r;return function(n){var i,h,c,p,d,f,g;if(3>n.length)return n;if(c=n.substr(0,1),"y"==c&&(n=c.toUpperCase()+n.substr(1)),p=/^(.+?)(ss|i)es$/,d=/^(.+?)([^s])s$/,p.test(n)?n=n.replace(p,"$1$2"):d.test(n)&&(n=n.replace(d,"$1$2")),p=/^(.+?)eed$/,d=/^(.+?)(ed|ing)$/,p.test(n)){var m=p.exec(n);p=RegExp(s),p.test(m[1])&&(p=/.$/,n=n.replace(p,""))}else if(d.test(n)){var m=d.exec(n);i=m[1],d=RegExp(a),d.test(i)&&(n=i,d=/(at|bl|iz)$/,f=RegExp("([^aeiouylsz])\\1$"),g=RegExp("^"+o+r+"[^aeiouwxy]$"),d.test(n)?n+="e":f.test(n)?(p=/.$/,n=n.replace(p,"")):g.test(n)&&(n+="e"))}if(p=/^(.+?)y$/,p.test(n)){var m=p.exec(n);i=m[1],p=RegExp(a),p.test(i)&&(n=i+"i")}if(p=/^(.+?)(ational|tional|enci|anci|izer|bli|alli|entli|eli|ousli|ization|ation|ator|alism|iveness|fulness|ousness|aliti|iviti|biliti|logi)$/,p.test(n)){var m=p.exec(n);i=m[1],h=m[2],p=RegExp(s),p.test(i)&&(n=i+e[h])}if(p=/^(.+?)(icate|ative|alize|iciti|ical|ful|ness)$/,p.test(n)){var m=p.exec(n);i=m[1],h=m[2],p=RegExp(s),p.test(i)&&(n=i+t[h])}if(p=/^(.+?)(al|ance|ence|er|ic|able|ible|ant|ement|ment|ent|ou|ism|ate|iti|ous|ive|ize)$/,d=/^(.+?)(s|t)(ion)$/,p.test(n)){var m=p.exec(n);i=m[1],p=RegExp(u),p.test(i)&&(n=i)}else if(d.test(n)){var m=d.exec(n);i=m[1]+m[2],d=RegExp(u),d.test(i)&&(n=i)}if(p=/^(.+?)e$/,p.test(n)){var m=p.exec(n);i=m[1],p=RegExp(u),d=RegExp(l),f=RegExp("^"+o+r+"[^aeiouwxy]$"),(p.test(i)||d.test(i)&&!f.test(i))&&(n=i)}return p=/ll$/,d=RegExp(u),p.test(n)&&d.test(n)&&(p=/.$/,n=n.replace(p,"")),"y"==c&&(n=c.toLowerCase()+n.substr(1)),n}}(),lunr.Pipeline.registerFunction(lunr.stemmer,"stemmer"),lunr.stopWordFilter=function(e){return-1===lunr.stopWordFilter.stopWords.indexOf(e)?e:void 0},lunr.stopWordFilter.stopWords=new lunr.SortedSet,lunr.stopWordFilter.stopWords.length=119,lunr.stopWordFilter.stopWords.elements=["a","able","about","across","after","all","almost","also","am","among","an","and","any","are","as","at","be","because","been","but","by","can","cannot","could","dear","did","do","does","either","else","ever","every","for","from","get","got","had","has","have","he","her","hers","him","his","how","however","i","if","in","into","is","it","its","just","least","let","like","likely","may","me","might","most","must","my","neither","no","nor","not","of","off","often","on","only","or","other","our","own","rather","said","say","says","she","should","since","so","some","than","that","the","their","them","then","there","these","they","this","tis","to","too","twas","us","wants","was","we","were","what","when","where","which","while","who","whom","why","will","with","would","yet","you","your"],lunr.Pipeline.registerFunction(lunr.stopWordFilter,"stopWordFilter"),lunr.TokenStore=function(){this.root={docs:{}},this.length=0},lunr.TokenStore.load=function(e){var t=new this;return t.root=e.root,t.length=e.length,t},lunr.TokenStore.prototype.add=function(e,t,n){var n=n||this.root,r=e[0],o=e.slice(1);return r in n||(n[r]={docs:{}}),0===o.length?(n[r].docs[t.ref]=t,this.length+=1,void 0):this.add(o,t,n[r])},lunr.TokenStore.prototype.has=function(e,t){var t=t||this.root,n=e[0],r=e.slice(1);return n in t?0===r.length?!0:this.has(r,t[n]):!1},lunr.TokenStore.prototype.getNode=function(e,t){var t=t||this.root,n=e[0],r=e.slice(1);return n in t?0===r.length?t[n]:this.getNode(r,t[n]):{}},lunr.TokenStore.prototype.get=function(e,t){return this.getNode(e,t).docs||{}},lunr.TokenStore.prototype.remove=function(e,t,n){var n=n||this.root,r=e[0],o=e.slice(1);if(r in n)return 0!==o.length?this.remove(o,t,n[r]):(delete n[r].docs[t],void 0)},lunr.TokenStore.prototype.expand=function(e,t){var n=this.getNode(e),r=n.docs||{},t=t||[];return Object.keys(r).length&&t.push(e),Object.keys(n).forEach(function(n){"docs"!==n&&t.concat(this.expand(e+n,t))},this),t},lunr.TokenStore.prototype.toJSON=function(){return{root:this.root,length:this.length}};
{
"name": "lunr",
"description": "Simple full-text search in your browser.",
"version": "0.2.3",
"version": "0.3.0",
"author": "Oliver Nightingale",

@@ -6,0 +6,0 @@ "keywords": ["search"],

@@ -69,1 +69,52 @@ module('lunr.Index')

})
test('serialising', function () {
var idx = new lunr.Index,
mockDocumentStore = { toJSON: function () { return 'documentStore' }},
mockTokenStore = { toJSON: function () { return 'tokenStore' }},
mockCorpusTokens = { toJSON: function () { return 'corpusTokens' }},
mockPipeline = { toJSON: function () { return 'pipeline' }}
idx.documentStore = mockDocumentStore
idx.tokenStore = mockTokenStore
idx.corpusTokens = mockCorpusTokens
idx.pipeline = mockPipeline
idx.ref('id')
idx.field('title', { boost: 10 })
idx.field('body')
deepEqual(idx.toJSON(), {
version: '@VERSION', // this is what the lunr version is set to before being built
fields: [
{ name: 'title', boost: 10 },
{ name: 'body', boost: 1 }
],
ref: 'id',
documentStore: 'documentStore',
tokenStore: 'tokenStore',
corpusTokens: 'corpusTokens',
pipeline: 'pipeline'
})
})
test('loading a serialised index', function () {
var serialisedData = {
version: '@VERSION', // this is what the lunr version is set to before being built
fields: [
{ name: 'title', boost: 10 },
{ name: 'body', boost: 1 }
],
ref: 'id',
documentStore: { store: {}, length: 0 },
tokenStore: { root: {}, length: 0 },
corpusTokens: [],
pipeline: ['stopWordFilter', 'stemmer']
}
var idx = lunr.Index.load(serialisedData)
deepEqual(idx._fields, serialisedData.fields)
equal(idx._ref, 'id')
})

@@ -1,3 +0,15 @@

module('lunr.Pipeline')
module('lunr.Pipeline', {
setup: function () {
this.existingRegisteredFunctions = lunr.Pipeline.registeredFunctions
lunr.Pipeline.registeredFunctions = {}
this.existingWarnIfFunctionNotRegistered = lunr.Pipeline.warnIfFunctionNotRegistered
lunr.Pipeline.warnIfFunctionNotRegistered = $.noop
},
teardown: function () {
lunr.Pipeline.registeredFunctions = this.existingRegisteredFunctions
lunr.Pipeline.warnIfFunctionNotRegistered = this.existingWarnIfFunctionNotRegistered
}
})
test("adding a new item to the pipeline", function () {

@@ -113,1 +125,50 @@ var pipeline = new lunr.Pipeline

})
test('toJSON', function () {
var pipeline = new lunr.Pipeline,
fn1 = function () {},
fn2 = function () {}
lunr.Pipeline.registerFunction(fn1, 'fn1')
lunr.Pipeline.registerFunction(fn2, 'fn2')
pipeline.add(fn1, fn2)
deepEqual(pipeline.toJSON(), ['fn1', 'fn2'])
})
test('registering a pipeline function', function () {
var fn1 = function () {}
equal(Object.keys(lunr.Pipeline.registeredFunctions).length, 0)
lunr.Pipeline.registerFunction(fn1, 'fn1')
equal(fn1.label, 'fn1')
equal(Object.keys(lunr.Pipeline.registeredFunctions).length, 1)
deepEqual(lunr.Pipeline.registeredFunctions['fn1'], fn1)
})
test('load', function () {
var fn1 = function () {},
fn2 = function () {}
lunr.Pipeline.registerFunction(fn1, 'fn1')
lunr.Pipeline.registerFunction(fn2, 'fn2')
var serialised = ['fn1', 'fn2']
var pipeline = lunr.Pipeline.load(serialised)
equal(pipeline._stack.length, 2)
deepEqual(pipeline._stack[0], fn1)
deepEqual(pipeline._stack[1], fn2)
})
test('loading an un-registered pipeline function', function () {
var serialised = ['fn1']
throws(function () {
lunr.Pipeline.load(serialised)
})
})

@@ -56,4 +56,11 @@ module('lunr.SortedSet')

set.add('foo', 'bar')
equal(set.indexOf('non member'), -1)
set.add('foo')
equal(set.indexOf('foo'), 0)
equal(set.indexOf('non member'), -1)
set.add('bar')
equal(set.indexOf('foo'), 1)

@@ -96,1 +103,18 @@ equal(set.indexOf('bar'), 0)

test('serialising', function () {
var emptySet = new lunr.SortedSet,
nonEmptySet = new lunr.SortedSet
nonEmptySet.add(1,2,3,4)
deepEqual(emptySet.toJSON(), [])
deepEqual(nonEmptySet.toJSON(), [1,2,3,4])
})
test('loading serialised dump', function () {
var serialisedData = [1,2,3,4],
set = lunr.SortedSet.load(serialisedData)
equal(set.length, 4)
deepEqual(set.elements, [1,2,3,4])
})

@@ -10,1 +10,6 @@ module('lunr.stemmer')

})
test('should be registered with lunr.Pipeline', function () {
equal(lunr.stemmer.label, 'stemmer')
deepEqual(lunr.Pipeline.registeredFunctions['stemmer'], lunr.stemmer)
})

@@ -18,1 +18,6 @@ module('lunr.stopWordFilter')

})
test('should be registered with lunr.Pipeline', function () {
equal(lunr.stopWordFilter.label, 'stopWordFilter')
deepEqual(lunr.Pipeline.registeredFunctions['stopWordFilter'], lunr.stopWordFilter)
})

@@ -38,1 +38,24 @@ module('lunr.Store')

test('serialising', function () {
var store = new lunr.Store
deepEqual(store.toJSON(), { store: {}, length: 0 })
store.set(1, ['eggs', 'ham'])
deepEqual(store.toJSON(), { store: { 1: ['eggs', 'ham'] }, length: 1 })
})
test('loading serialised data', function () {
var serialisedData = {
length: 1,
store: {
1: ['eggs', 'ham']
}
}
var store = lunr.Store.load(serialisedData)
equal(store.length, 1)
deepEqual(store.get(1), lunr.SortedSet.load(['eggs', 'ham']))
})

@@ -111,1 +111,51 @@ module('lunr.TokenStore')

})
test('serialisation', function () {
var store = new lunr.TokenStore
deepEqual(store.toJSON(), { root: { docs: {} }, length: 0 })
store.add('foo', { ref: 123, tf: 1 })
deepEqual(store.toJSON(),
{
root: {
docs: {},
f: {
docs: {},
o: {
docs: {},
o: {
docs: { 123: { ref: 123, tf: 1 } }
}
}
}
},
length: 1
}
)
})
test('loading a serialised story', function () {
var serialisedData = {
root: {
docs: {},
f: {
docs: {},
o: {
docs: {},
o: {
docs: { 123: { ref: 123, tf: 1 } }
}
}
}
},
length: 1
}
var store = lunr.TokenStore.load(serialisedData),
documents = store.get('foo')
equal(store.length, 1)
deepEqual(documents, { 123: { ref: 123, tf: 1 }})
})

@@ -41,3 +41,3 @@ module('lunr.tokenizer')

test('handling multiple white spaces', function () {
var testString = 'foo bar',
var testString = ' foo bar ',
tokens = lunr.tokenizer(testString)

@@ -44,0 +44,0 @@

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc