Skip to content

Commit

Permalink
Switch to quick-score for fuzzy search (leftover) (#2370)
Browse files Browse the repository at this point in the history
* Switch to quick-score for fuzzy search

* Sort dependencies

* Sort dependencies, again

---------

Co-authored-by: Tobia Bocchi <tobiabocchi@serendipity.local>
  • Loading branch information
tobiabocchi and Tobia Bocchi committed Jan 20, 2024
1 parent 0cbc52f commit ec5bf35
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion js/searchbar/customBangs.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

const { ipcRenderer } = require('electron')
const fs = require('fs')
const quickScore = require('quick-score').quickScore

const bangsPlugin = require('searchbar/bangsPlugin.js')

Expand Down Expand Up @@ -84,7 +85,7 @@ function searchAndSortTasks (text) {
const task = t.task
const taskName = (task.name ? task.name : l('defaultTaskName').replace('%n', tasks.getIndex(task.id) + 1)).toLowerCase()
const exactMatch = taskName.indexOf(searchText) !== -1
const fuzzyTitleScore = taskName.score(searchText, 0.5)
const fuzzyTitleScore = quickScore(taskName, searchText)

return (exactMatch || fuzzyTitleScore > 0.4)
})
Expand Down

0 comments on commit ec5bf35

Please sign in to comment.