From 9f361be5dfa527e46ed3b4bcdc191b4b477f87bd Mon Sep 17 00:00:00 2001 From: Guangcong Luo Date: Mon, 12 Sep 2016 17:14:10 -0700 Subject: [PATCH] Teambuilder: Support searching by middle word Previously, you could search by the first or last word in a three-word phrase, but not the middle so "High" and "Kick" but not "Jump" in "High Jump Kick". This lets you search by all three. --- githooks/build-indexes | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/githooks/build-indexes b/githooks/build-indexes index 19152c283..bbb21ca5d 100755 --- a/githooks/build-indexes +++ b/githooks/build-indexes @@ -89,6 +89,12 @@ function requireNoCache(pathSpec) { if (acronym && !(acronym in Tools.data.Aliases) || toId(Tools.data.Aliases[acronym]) !== id) { index.push('' + acronym + ' ' + type + ' ' + id + ' 0'); } + + let i2 = name.lastIndexOf(' ', i - 1); + if (i2 < 0) i2 = name.lastIndexOf('-', i - 1); + if (i2 >= 0) { + index.push('' + toId(name.slice(i2)) + ' ' + type + ' ' + id + ' ' + toId(name.slice(0, i2)).length); + } } for (const id in Tools.data.Pokedex) { const name = Tools.data.Pokedex[id].species;