Skip to main content

Function: expandTopics()

expandTopics<T>(input, scoring?, options?): T[]

Defined in: Services/Search/TopicExpansion.ts:95

Expand topic results into verse lists and merge with non-topic results.

Algorithm:

  1. Filter topics below topicMinScore threshold
  2. For each topic, compute verse scores with damping and boost
  3. Apply leapfrog cap: topic verse scores cannot exceed best non-topic score
  4. Merge + dedup by verseId (keep highest score)
  5. Apply intersection bonus if enabled

Type Parameters

T

T extends ExpandableResult

Parameters

input

TopicExpansionInput<T>

Pre-fetched topic data and non-topic results

scoring?

ScoringConfig

Scoring config (topicDamping, topicBoost, topicMinScore, facetScoring)

options?

TopicExpansionOptions = {}

Expansion behavior options

Returns

T[]

Merged results sorted by score descending