Skip to content

Commit

Permalink
Sort the search results from the index #57
Browse files Browse the repository at this point in the history
  • Loading branch information
peterhil committed Jul 25, 2021
1 parent d9e2400 commit 22d9a94
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/js/background/popup-controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,9 @@ export const popupController = {
const ids = index.search(message.query)
console.debug('[popup controller] using index')
const result = pick(ids, allCategories)
const sorted = sortByTitleCaseInsensitive(values(result))

sendMessage(port, 'searchResults', values(result))
sendMessage(port, 'searchResults', sorted)
}
else {
console.debug('[popup controller] using browser api')
Expand All @@ -76,15 +77,15 @@ export const popupController = {
const categories = pipe(
flattenTree,
filter(isCategory),
sortByTitleCaseInsensitive,
// sortByTitleCaseInsensitive,
)(bookmarks || [])

// console.debug({ categories })
// const allCategories = fromPairs(pick(['id', 'title'], categories))
forEach(
(category) => {
index.add(category.title, category.id)
allCategories[category.id] = category // TODO Use map
allCategories[category.id] = category // TODO Use map?
},
categories
)
Expand Down

0 comments on commit 22d9a94

Please sign in to comment.