mirror of
https://github.com/alexankitty/Myrient-Search-Engine.git
synced 2026-01-19 20:33:09 -03:00
fix fields
This commit is contained in:
@@ -6,8 +6,7 @@ export default class Searcher{
|
||||
this.distance = parseFloat(process.env.FUZZY_DISTANCE)
|
||||
this.minMatch = parseFloat(process.env.MIN_MATCH)
|
||||
this.indexing = false
|
||||
fields.push('id')
|
||||
this.fields = fields
|
||||
this.fields = [...fields]
|
||||
this.createIndex(fileArr)
|
||||
}
|
||||
|
||||
@@ -45,6 +44,8 @@ export default class Searcher{
|
||||
this.indexing = false
|
||||
}
|
||||
async updateIndex(fileArr){
|
||||
let fields = [...this.fields]
|
||||
fields.push('id')
|
||||
console.log('Performing Index Update.')
|
||||
for(let x = 0; x < fileArr.length; x++){
|
||||
let searchIndex = this.findIndex(x)
|
||||
@@ -55,8 +56,8 @@ export default class Searcher{
|
||||
continue
|
||||
}
|
||||
let changed = false
|
||||
for(let field in this.fields){
|
||||
let fieldName = this.fields[field]
|
||||
for(let field in fields){
|
||||
let fieldName = fields[field]
|
||||
let searchField = searchIndex[fieldName]
|
||||
let fileField = fileArr[x][fieldName]
|
||||
debugPrint(`${fieldName}: ${searchField} ${fileField}`)
|
||||
|
||||
Reference in New Issue
Block a user