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.
Hierarchy
-
↳
KeywordTableIndex
Constructors
constructor
• new KeywordTableIndex(init
)
Parameters
Name | Type |
---|---|
init | BaseIndexInit <KeywordTable > |
Overrides
Defined in
packages/core/src/indices/keyword/KeywordTableIndex.ts:49
Properties
docStore
• docStore: BaseDocumentStore
Inherited from
Defined in
packages/core/src/indices/BaseIndex.ts:156
indexStore
• Optional
indexStore: BaseIndexStore
Inherited from
Defined in
packages/core/src/indices/BaseIndex.ts:158
indexStruct
• indexStruct: KeywordTable
Inherited from
Defined in
packages/core/src/indices/BaseIndex.ts:159
serviceContext
• serviceContext: ServiceContext
Inherited from
Defined in
packages/core/src/indices/BaseIndex.ts:154
storageContext
• storageContext: StorageContext
Inherited from
Defined in
packages/core/src/indices/BaseIndex.ts:155
vectorStore
• Optional
vectorStore: VectorStore
Inherited from
Defined in
packages/core/src/indices/BaseIndex.ts:157
Methods
asQueryEngine
▸ asQueryEngine(options?
): BaseQueryEngine
Create a new query engine from the index. It will also create a retriever and response synthezier if they are not provided.
Parameters
Name | Type | Description |
---|---|---|
options? | Object | you can supply your own custom Retriever and ResponseSynthesizer |
options.nodePostprocessors? | BaseNodePostprocessor [] | - |
options.preFilters? | unknown | - |
options.responseSynthesizer? | ResponseSynthesizer | - |
options.retriever? | BaseRetriever | - |
Returns
Overrides
Defined in
packages/core/src/indices/keyword/KeywordTableIndex.ts:130
asRetriever
▸ asRetriever(options?
): BaseRetriever
Create a new retriever from the index.
Parameters
Name | Type |
---|---|
options? | any |
Returns
Overrides
Defined in
packages/core/src/indices/keyword/KeywordTableIndex.ts:119
deleteNode
▸ deleteNode(nodeId
): void
Parameters
Name | Type |
---|---|
nodeId | string |
Returns
void
Defined in
packages/core/src/indices/keyword/KeywordTableIndex.ts:224
deleteNodes
▸ deleteNodes(nodeIds
, deleteFromDocStore
): Promise
<void
>
Parameters
Name | Type |
---|---|
nodeIds | string [] |
deleteFromDocStore | boolean |
Returns
Promise
<void
>
Defined in
packages/core/src/indices/keyword/KeywordTableIndex.ts:242
deleteRefDoc
▸ deleteRefDoc(refDocId
, deleteFromDocStore?
): Promise
<void
>
Parameters
Name | Type |
---|---|
refDocId | string |
deleteFromDocStore? | boolean |
Returns
Promise
<void
>
Overrides
Defined in
packages/core/src/indices/keyword/KeywordTableIndex.ts:256
insert
▸ insert(document
): Promise
<void
>
Insert a document into the index.
Parameters
Name | Type |
---|---|
document | Document <Metadata > |
Returns
Promise
<void
>
Inherited from
Defined in
packages/core/src/indices/BaseIndex.ts:190
insertNodes
▸ insertNodes(nodes
): Promise
<void
>
Parameters
Name | Type |
---|---|
nodes | BaseNode <Metadata >[] |
Returns
Promise
<void
>
Overrides
Defined in
packages/core/src/indices/keyword/KeywordTableIndex.ts:214
buildIndexFromNodes
▸ Static
buildIndexFromNodes(nodes
, docStore
, serviceContext
): Promise
<KeywordTable
>
Get keywords for nodes and place them into the index.
Parameters
Name | Type |
---|---|
nodes | BaseNode <Metadata >[] |
docStore | BaseDocumentStore |
serviceContext | ServiceContext |
Returns
Promise
<KeywordTable
>
Defined in
packages/core/src/indices/keyword/KeywordTableIndex.ts:197
extractKeywords
▸ Static
extractKeywords(text
, serviceContext
): Promise
<Set
<string
>>
Parameters
Name | Type |
---|---|
text | string |
serviceContext | ServiceContext |
Returns
Promise
<Set
<string
>>
Defined in
packages/core/src/indices/keyword/KeywordTableIndex.ts:145
fromDocuments
▸ Static
fromDocuments(documents
, args?
): Promise
<KeywordTableIndex
>
High level API: split documents, get keywords, and build index.
Parameters
Name | Type |
---|---|
documents | Document <Metadata >[] |
args | Object |
args.serviceContext? | ServiceContext |
args.storageContext? | StorageContext |
Returns
Promise
<KeywordTableIndex
>
Defined in
packages/core/src/indices/keyword/KeywordTableIndex.ts:164
init
▸ Static
init(options
): Promise
<KeywordTableIndex
>
Parameters
Name | Type |
---|---|
options | KeywordIndexOptions |
Returns
Promise
<KeywordTableIndex
>