fix fields

This commit is contained in:
Alexandra
2024-10-22 03:37:02 -06:00
parent fa4480a518
commit cd643b9cc0

View File

@@ -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}`)