in miredot/lib/lunr/js/lunr.js [1380:1417]
lunr.TokenSet.fromString = function (str) {
var node = new lunr.TokenSet,
root = node,
wildcardFound = false
/*
* Iterates through all characters within the passed string
* appending a node for each character.
*
* As soon as a wildcard character is found then a self
* referencing edge is introduced to continually match
* any number of any characters.
*/
for (var i = 0, len = str.length; i < len; i++) {
var char = str[i],
final = (i == len - 1)
if (char == "*") {
wildcardFound = true
node.edges[char] = node
node.final = final
} else {
var next = new lunr.TokenSet
next.final = final
node.edges[char] = next
node = next
// TODO: is this needed anymore?
if (wildcardFound) {
node.edges["*"] = root
}
}
}
return root
}