Search Sorting Extension

Purpose

Customizes CoreBox ranking so your plugin surfaces at the right moment without hijacking the list.

Hook

ctx.corebox.registerSorter('mySorter', ({ query, results }) => {
  const boosted = results.map(item => {
    if (item.pluginId === ctx.meta.id && query.includes('todo')) {
      return { ...item, score: item.score + 20 }
    }
    return item
  })
  return boosted.sort((a, b) => b.score - a.score)
})

Strategy

  • Combine keyword matches, recency, and context signals.
  • Never inflate scores unconditionally—preserve overall quality.

Debug

  • sorter:list shows registered sorters.
  • sorter:trace prints scoring breakdowns per result.