add indexing message

This commit is contained in:
Alexandra
2024-10-19 00:54:48 -06:00
parent 24029f218e
commit 5f23053489
3 changed files with 6 additions and 2 deletions

View File

@@ -4,6 +4,7 @@ export default class Searcher{
constructor(fileArr, fields){
this.distance = parseFloat(process.env.FUZZY_DISTANCE)
this.minMatch = parseFloat(process.env.MIN_MATCH)
this.indexing = false
this.createIndex(fileArr, fields)
}
@@ -36,10 +37,12 @@ export default class Searcher{
else{
this.miniSearch.removeAll()
}
this.indexing = true
this.miniSearch.addAllAsync(fileArr)
.then( result => {
console.log('File list indexing completed.')
console.log(`Total terms in index: ${this.miniSearch.termCount}`)
this.indexing = false
})
}
parseHrtimeToSeconds(hrtime){

View File

@@ -107,7 +107,8 @@ app.get("/settings", function(req, res) {
res.render('pages/index', {
page: 'settings',
crawlTime: crawlTime,
defaultSettings: defaultSettings
defaultSettings: defaultSettings,
indexing: search.indexing
})
})

View File

@@ -14,7 +14,7 @@ _ / / / _ /_/ /_ / _ / / __/ / / / /_
<button type="submit" class="btn btn-secondary ml-2">Search</button>
</div>
</div>
<p class="m-2">Found <%= results.items.length %> result<%= results.items.length != 1 ? 's': '' %> in <%= results.elapsed %> seconds. <%= results.elapsed > 10 ? ' Lucky you, you caught the indexer while it was running.' : '' %></p>
<p class="m-2">Found <%= results.items.length %> result<%= results.items.length != 1 ? 's': '' %> in <%= results.elapsed %> seconds. <%= indexing ? "Indexing in progress, if the list is missing something please try reloading in a few minutes" : "" %></p>
</form>
<div class="col-sm-12 w-100 mt-3">