mirror of
https://github.com/alexankitty/Myrient-Search-Engine.git
synced 2026-01-15 16:33:15 -03:00
Implemented region, fixed file name regression, fixed a lot of other stuff.
This commit is contained in:
@@ -362,33 +362,47 @@
|
||||
]
|
||||
},
|
||||
"Types": [
|
||||
"BIOS",
|
||||
"BigEndian",
|
||||
"ByteSwapped",
|
||||
"CBZ",
|
||||
"DLC",
|
||||
"Decrypted",
|
||||
"Development Kit",
|
||||
"Digital",
|
||||
"Disc Keys",
|
||||
"GameShark",
|
||||
"Header",
|
||||
"Headerless",
|
||||
"LittleEndian",
|
||||
"NKit",
|
||||
"NoNpDrm",
|
||||
"PDF",
|
||||
"PS one Classics",
|
||||
"PSN",
|
||||
"PSX2PSP",
|
||||
"RAW",
|
||||
"Source Code",
|
||||
"UMD Music",
|
||||
"UMD Video",
|
||||
"Updates and DLC",
|
||||
"Updates",
|
||||
"VPK",
|
||||
"Visual Memory Unit",
|
||||
"WUX"
|
||||
"(BIOS)",
|
||||
"(BigEndian)",
|
||||
"(ByteSwapped)",
|
||||
"(CBZ)",
|
||||
"(DLC)",
|
||||
"(Decrypted)",
|
||||
"(Development Kit)",
|
||||
"(Digital)",
|
||||
"(Disc Keys)",
|
||||
"(GameShark)",
|
||||
"(Header)",
|
||||
"(Headerless)",
|
||||
"(LittleEndian)",
|
||||
"(NKit)",
|
||||
"(NoNpDrm)",
|
||||
"(PDF)",
|
||||
"(PS one Classics)",
|
||||
"(PSN)",
|
||||
"(PSX2PSP)",
|
||||
"(RAW)",
|
||||
"(Source Code)",
|
||||
"(UMD Music)",
|
||||
"(UMD Video)",
|
||||
"(Updates and DLC)",
|
||||
"(Updates)",
|
||||
"(VPK)",
|
||||
"(Visual Memory Unit)",
|
||||
"(WUX)"
|
||||
],
|
||||
"Regions": [
|
||||
"USA",
|
||||
"Europe",
|
||||
"Germany",
|
||||
"Italy",
|
||||
"Korea",
|
||||
"Spain",
|
||||
"France",
|
||||
"Japan",
|
||||
"Brazil",
|
||||
"World",
|
||||
"UK",
|
||||
"Asia"
|
||||
]
|
||||
}
|
||||
@@ -59,6 +59,7 @@ async function getFilesAndFolders(url, catList, base = ""){
|
||||
category: findCategory(base + name, catList),
|
||||
type: findType(base + name, catList),
|
||||
date: innertext(fileList[x].querySelector('.date').innerHTML).trim(),
|
||||
region: findRegion(base + name, catList)
|
||||
})
|
||||
}
|
||||
return fileArray
|
||||
@@ -98,12 +99,13 @@ function singleLineStatus(str){
|
||||
}
|
||||
|
||||
function findCategory(str, catList){
|
||||
let lowerStr = str.toLowerCase()
|
||||
let foundCat = ''
|
||||
let catLength = 0
|
||||
let foundSubCat = ''
|
||||
let subCatLength = 0
|
||||
for(let cat in catList.Categories){
|
||||
if(str.includes(cat)){
|
||||
if(lowerStr.includes(cat.toLowerCase())){
|
||||
if(cat.length > catLength){
|
||||
foundCat = cat
|
||||
catLength = cat.length
|
||||
@@ -112,10 +114,11 @@ function findCategory(str, catList){
|
||||
}
|
||||
if(foundCat){
|
||||
for(let subCat in catList.Categories[foundCat]){
|
||||
if(str.includes(subCat)){
|
||||
if(subCat.length > subCatLength){
|
||||
foundSubCat = catList.Categories[foundCat][subCat]
|
||||
subCatLength = subCat.length
|
||||
let subCatString = catList.Categories[foundCat][subCat] //I will go insane if this is inlined repeatedly
|
||||
if(lowerStr.includes(subCatString.toLowerCase())){
|
||||
if(subCatString.length > subCatLength){
|
||||
foundSubCat = subCatString
|
||||
subCatLength = subCatString.length
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -123,15 +126,37 @@ function findCategory(str, catList){
|
||||
else{
|
||||
return 'Other'
|
||||
}
|
||||
return `${foundCat} ${foundSubCat}`
|
||||
return `${foundCat} ${foundSubCat}`.trim()
|
||||
}
|
||||
|
||||
function findType(str, catList){
|
||||
let lowerStr = str.toLowerCase()
|
||||
let foundTypes = ''
|
||||
for(let type in catList.Types){
|
||||
if(str.includes(type)){
|
||||
foundTypes += `(${catList.Types[type]}) `
|
||||
let typeString = catList.Types[type] //including here
|
||||
if(lowerStr.includes(typeString.toLowerCase())){
|
||||
foundTypes += `${typeString} `
|
||||
}
|
||||
}
|
||||
return foundTypes.trim()
|
||||
}
|
||||
|
||||
function findRegion(str, catList){
|
||||
let lowerStr = str.toLowerCase()
|
||||
let foundRegions = ''
|
||||
for(let region in catList.Regions){
|
||||
let regionString = catList.Regions[region] //including here
|
||||
if(lowerStr.includes(regionString.toLowerCase())){
|
||||
if(foundRegions){
|
||||
foundRegions += `, ${regionString}`
|
||||
}
|
||||
else{
|
||||
foundRegions += `${regionString}`
|
||||
}
|
||||
}
|
||||
}
|
||||
if(!foundRegions){
|
||||
return "None"
|
||||
}
|
||||
return foundRegions.trim()
|
||||
}
|
||||
@@ -24,7 +24,7 @@ export default class Searcher{
|
||||
createIndex(fileArr){
|
||||
this.miniSearch = new MiniSearch({
|
||||
fields: ['name', 'category', 'type'],
|
||||
storeFields: ['name', 'category', 'type', 'date', 'size'],
|
||||
storeFields: ['filename', 'category', 'type', 'date', 'size', 'region'],
|
||||
searchOptions: {
|
||||
boost: { name: 2 },
|
||||
fuzzy: this.distance,
|
||||
|
||||
@@ -17,6 +17,9 @@ async function getFilesJob(){
|
||||
console.log('Updating the file list.')
|
||||
fileList = await getAllFiles(categoryList)
|
||||
saveJsonFile(fileListPath, fileList)
|
||||
if(search){
|
||||
search.createIndex(fileList) //recreate the search index
|
||||
}
|
||||
console.log(`Finished updating file list. ${fileList.length} found.`)
|
||||
}
|
||||
|
||||
|
||||
@@ -22,7 +22,8 @@ _ / / / _ /_/ /_ / _ / / __/ / / / /_
|
||||
<tr>
|
||||
<th>Name</th>
|
||||
<th>Category</th>
|
||||
<th>type</th>
|
||||
<th>Region</th>
|
||||
<th>Type</th>
|
||||
<th>Size</th>
|
||||
<th>Date</th>
|
||||
<th>Search Score</th>
|
||||
@@ -31,12 +32,15 @@ _ / / / _ /_/ /_ / _ / / __/ / / / /_
|
||||
<tr>
|
||||
<td>
|
||||
<a href="<%= results.items[x].path %>">
|
||||
<%= results.items[x].name %>
|
||||
<%= results.items[x].filename %>
|
||||
</a>
|
||||
</td>
|
||||
<td>
|
||||
<%= results.items[x].category %>
|
||||
</td>
|
||||
<td>
|
||||
<%= results.items[x].region %>
|
||||
</td>
|
||||
<td>
|
||||
<%= results.items[x].type %>
|
||||
</td>
|
||||
|
||||
Reference in New Issue
Block a user