close #1
This commit is contained in:
parent
baa691fa03
commit
f88202b792
22
main.js
22
main.js
@ -226,8 +226,26 @@ function search(word) {
|
|||||||
for (let key in searchDictionary) {
|
for (let key in searchDictionary) {
|
||||||
for (let value in searchDictionary[key]) {
|
for (let value in searchDictionary[key]) {
|
||||||
if (searchDictionary[key][value].includes(word)) {
|
if (searchDictionary[key][value].includes(word)) {
|
||||||
result.push(key);
|
if (value == 0) {
|
||||||
break; //????
|
result.push(key);
|
||||||
|
break;
|
||||||
|
} else {
|
||||||
|
//if its a description (i.e: includes a space)
|
||||||
|
//do startsWith or something instead to prevent
|
||||||
|
//false positive search results
|
||||||
|
let t = false;
|
||||||
|
let d = searchDictionary[key][value].split(" ")
|
||||||
|
for (let w in d) {
|
||||||
|
if (d[w].startsWith(word)) {
|
||||||
|
t = true;
|
||||||
|
console.log(searchDictionary[key][value] + " " + d[w]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (t) {
|
||||||
|
result.push(key);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user