Skip to content

BM25Index

reference
1 min readUpdated

Kind: Class

Source: atloria-monorepo/libs/agent-core/src/semantic/bm25.ts

Methods

MethodSignatureReturns
addDocumentaddDocument(id: string, text: string)void
removeDocumentremoveDocument(id: string)void
searchsearch(query: string, topK: undefined)Array<{ id: string; score: number }>
clearclear()void
serializeserialize()SerializedIndex
deserializedeserialize(data: object)BM25Index

Where it refuses work

  • BM25Index stops the work with an early return when docLen === undefined.
  • BM25Index stops the work with an early return when queryTokens.length === 0 || this.documentCount === 0.
  • BM25Index stops the work with an early return when !d.terms || !d.docLengths.

Was this page helpful?

Download as PDF