-- variable input: search term
-- variable snippets: array with all snippets (as delivered by http://tinybrain.de:8080/tb-int/allsnippets.php)
-- returns: array of matching snippets
-- best matches first (well, smarter search engines would do that)
--
-- if we also get the snippet texts, we will match those too.
-- but that is a lot of data...
found = {}
foundLevelTwo = {}
input = input:lower()
for _, s in ipairs(snippets.snippets) do
if s.name:lower():find(input, 1, true) or s.id == input or ("#"..s.id) == input then
table.insert(found, s)
elseif s.text and s.text:lower():find(input, 1, true) then
table.insert(foundLevelTwo, s)
end
end
-- merge two lists
for _, s in ipairs(foundLevelTwo) do table.insert(found, s) end
-- return
return foundTODO: changes case of snippet names according to input (wtf?)
test run test run with input download show line numbers
Travelled to 12 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt
2 comment(s) hidden. show
| Recognizer | Recognition Result | Visualize | Recalc |
|---|---|---|---|
| #308 | 755 | [visualize] |