Skip to main content

Class: KeywordTableIndex

The KeywordTableIndex, an index that extracts keywords from each Node and builds a mapping from each keyword to the corresponding Nodes of that keyword.

Extends

Constructors

new KeywordTableIndex()

new KeywordTableIndex(init): KeywordTableIndex

Parameters

init: BaseIndexInit <KeywordTable>

Returns

KeywordTableIndex

Overrides

BaseIndex . constructor

Source

packages/llamaindex/src/indices/keyword/index.ts:157

Properties

docStore

docStore: BaseDocumentStore

Inherited from

BaseIndex . docStore

Source

packages/llamaindex/src/indices/BaseIndex.ts:60


indexStore?

optional indexStore: BaseIndexStore

Inherited from

BaseIndex . indexStore

Source

packages/llamaindex/src/indices/BaseIndex.ts:61


indexStruct

indexStruct: KeywordTable

Inherited from

BaseIndex . indexStruct

Source

packages/llamaindex/src/indices/BaseIndex.ts:62


serviceContext?

optional serviceContext: ServiceContext

Inherited from

BaseIndex . serviceContext

Source

packages/llamaindex/src/indices/BaseIndex.ts:58


storageContext

storageContext: StorageContext

Inherited from

BaseIndex . storageContext

Source

packages/llamaindex/src/indices/BaseIndex.ts:59

Methods

asQueryEngine()

asQueryEngine(options?): QueryEngine

Create a new query engine from the index. It will also create a retriever and response synthezier if they are not provided.

Parameters

options?

you can supply your own custom Retriever and ResponseSynthesizer

options.nodePostprocessors?: BaseNodePostprocessor[]

options.preFilters?: unknown

options.responseSynthesizer?: BaseSynthesizer

options.retriever?: BaseRetriever

Returns

QueryEngine

Overrides

BaseIndex . asQueryEngine

Source

packages/llamaindex/src/indices/keyword/index.ts:237


asRetriever()

asRetriever(options?): BaseRetriever

Create a new retriever from the index.

Parameters

options?: any

Returns

BaseRetriever

Overrides

BaseIndex . asRetriever

Source

packages/llamaindex/src/indices/keyword/index.ts:226


deleteNode()

deleteNode(nodeId): void

Parameters

nodeId: string

Returns

void

Source

packages/llamaindex/src/indices/keyword/index.ts:334


deleteNodes()

deleteNodes(nodeIds, deleteFromDocStore): Promise<void>

Parameters

nodeIds: string[]

deleteFromDocStore: boolean

Returns

Promise<void>

Source

packages/llamaindex/src/indices/keyword/index.ts:352


deleteRefDoc()

deleteRefDoc(refDocId, deleteFromDocStore?): Promise<void>

Parameters

refDocId: string

deleteFromDocStore?: boolean

Returns

Promise<void>

Overrides

BaseIndex . deleteRefDoc

Source

packages/llamaindex/src/indices/keyword/index.ts:366


insert()

insert(document): Promise<void>

Insert a document into the index.

Parameters

document: Document <Metadata>

Returns

Promise<void>

Inherited from

BaseIndex . insert

Source

packages/llamaindex/src/indices/BaseIndex.ts:92


insertNodes()

insertNodes(nodes): Promise<void>

Parameters

nodes: BaseNode <Metadata>[]

Returns

Promise<void>

Overrides

BaseIndex . insertNodes

Source

packages/llamaindex/src/indices/keyword/index.ts:324


buildIndexFromNodes()

static buildIndexFromNodes(nodes, docStore, serviceContext?): Promise <KeywordTable>

Get keywords for nodes and place them into the index.

Parameters

nodes: BaseNode <Metadata>[]

docStore: BaseDocumentStore

serviceContext?: ServiceContext

Returns

Promise <KeywordTable>

Source

packages/llamaindex/src/indices/keyword/index.ts:307


extractKeywords()

static extractKeywords(text, serviceContext?): Promise<Set<string>>

Parameters

text: string

serviceContext?: ServiceContext

Returns

Promise<Set<string>>

Source

packages/llamaindex/src/indices/keyword/index.ts:252


fromDocuments()

static fromDocuments(documents, args): Promise <KeywordTableIndex>

High level API: split documents, get keywords, and build index.

Parameters

documents: Document <Metadata>[]

args= {}

args.serviceContext?: ServiceContext

args.storageContext?: StorageContext

Returns

Promise <KeywordTableIndex>

Source

packages/llamaindex/src/indices/keyword/index.ts:274


init()

static init(options): Promise <KeywordTableIndex>

Parameters

options: KeywordIndexOptions

Returns

Promise <KeywordTableIndex>

Source

packages/llamaindex/src/indices/keyword/index.ts:161