mirror of
https://github.com/alexankitty/Myrient-Search-Engine.git
synced 2026-01-15 16:33:15 -03:00
Instance name from environment & About page
This commit is contained in:
9
lib/asciiart.js
Normal file
9
lib/asciiart.js
Normal file
@@ -0,0 +1,9 @@
|
||||
import figlet from 'figlet';
|
||||
|
||||
export function generateAsciiArt(text) {
|
||||
return figlet.textSync(text || process.env.INSTANCE_NAME || 'Myrient', {
|
||||
font: 'Slant',
|
||||
horizontalLayout: 'default',
|
||||
verticalLayout: 'default'
|
||||
});
|
||||
}
|
||||
@@ -11,7 +11,7 @@ export default class Searcher{
|
||||
}
|
||||
|
||||
termProcessor(term){
|
||||
term = term.toLowerCase()
|
||||
term = term.toLowerCase()
|
||||
let stringArray = [term]
|
||||
stringArray.push(...Searcher.stringBreakout(term))
|
||||
for(let group in searchAlikes.StringAssoc){
|
||||
@@ -25,7 +25,7 @@ export default class Searcher{
|
||||
}
|
||||
}
|
||||
return [...new Set(stringArray)]
|
||||
}
|
||||
}
|
||||
|
||||
static stringBreakout(string){
|
||||
let symbolRegex = /-|_|\+|=|\)|\(|\[|{|}|]|;|:|"|'|<|>|\.|,|\/|\?|\||\\|!|@|#|\$|%|\^|&|\*/g
|
||||
@@ -62,7 +62,7 @@ export default class Searcher{
|
||||
console.error(err)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
async createIndex(fileArr){
|
||||
if(!this.miniSearch){
|
||||
this.miniSearch = new MiniSearch({
|
||||
@@ -157,7 +157,7 @@ export default class Searcher{
|
||||
else {
|
||||
//bad result discard
|
||||
continue
|
||||
}
|
||||
}
|
||||
suggestions.push(`${query}${prediction}`)
|
||||
continue
|
||||
}
|
||||
@@ -178,10 +178,10 @@ export default class Searcher{
|
||||
else {
|
||||
//bad result discard
|
||||
continue
|
||||
}
|
||||
}
|
||||
suggestions.push(`${query}${prediction}`)
|
||||
continue
|
||||
}
|
||||
}
|
||||
}
|
||||
let dedupe = [...new Set(suggestions)]
|
||||
let dedupeLimit = dedupe.length >= 10 ? 10 : dedupe.length
|
||||
@@ -190,7 +190,7 @@ export default class Searcher{
|
||||
arr.push({
|
||||
suggestion: dedupe[x]
|
||||
})
|
||||
}
|
||||
}
|
||||
return arr
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user