_Ref-Storage-Index-Store:
索引存储
- class llama_index.storage.index_store.KVIndexStore(kvstore: BaseKVStore, namespace: Optional[str] = None)
Key-Value Index store.
- 参数
kvstore (BaseKVStore) -- key-value store
namespace (str) -- namespace for the index store
- add_index_struct(index_struct: IndexStruct) None
Add an index struct.
- 参数
index_struct (IndexStruct) -- index struct
- delete_index_struct(key: str) None
Delete an index struct.
- 参数
key (str) -- index struct key
- get_index_struct(struct_id: Optional[str] = None) Optional[IndexStruct]
Get an index struct.
- 参数
struct_id (Optional[str]) -- index struct id
- index_structs() List[IndexStruct]
Get all index structs.
- 返回
index structs
- 返回类型
List[IndexStruct]
- persist(persist_path: str = './storage/index_store.json', fs: Optional[AbstractFileSystem] = None) None
Persist the index store to disk.
- class llama_index.storage.index_store.MongoIndexStore(mongo_kvstore: MongoDBKVStore, namespace: Optional[str] = None)
Mongo Index store.
- 参数
mongo_kvstore (MongoDBKVStore) -- MongoDB key-value store
namespace (str) -- namespace for the index store
- add_index_struct(index_struct: IndexStruct) None
Add an index struct.
- 参数
index_struct (IndexStruct) -- index struct
- delete_index_struct(key: str) None
Delete an index struct.
- 参数
key (str) -- index struct key
- classmethod from_host_and_port(host: str, port: int, db_name: Optional[str] = None, namespace: Optional[str] = None) MongoIndexStore
Load a MongoIndexStore from a MongoDB host and port.
- classmethod from_uri(uri: str, db_name: Optional[str] = None, namespace: Optional[str] = None) MongoIndexStore
Load a MongoIndexStore from a MongoDB URI.
- get_index_struct(struct_id: Optional[str] = None) Optional[IndexStruct]
Get an index struct.
- 参数
struct_id (Optional[str]) -- index struct id
- index_structs() List[IndexStruct]
Get all index structs.
- 返回
index structs
- 返回类型
List[IndexStruct]
- persist(persist_path: str = './storage/index_store.json', fs: Optional[AbstractFileSystem] = None) None
Persist the index store to disk.
- class llama_index.storage.index_store.SimpleIndexStore(simple_kvstore: Optional[SimpleKVStore] = None)
Simple in-memory Index store.
- 参数
simple_kvstore (SimpleKVStore) -- simple key-value store
- add_index_struct(index_struct: IndexStruct) None
Add an index struct.
- 参数
index_struct (IndexStruct) -- index struct
- delete_index_struct(key: str) None
Delete an index struct.
- 参数
key (str) -- index struct key
- classmethod from_persist_dir(persist_dir: str = './storage', fs: Optional[AbstractFileSystem] = None) SimpleIndexStore
Create a SimpleIndexStore from a persist directory.
- classmethod from_persist_path(persist_path: str, fs: Optional[AbstractFileSystem] = None) SimpleIndexStore
Create a SimpleIndexStore from a persist path.
- get_index_struct(struct_id: Optional[str] = None) Optional[IndexStruct]
Get an index struct.
- 参数
struct_id (Optional[str]) -- index struct id
- index_structs() List[IndexStruct]
Get all index structs.
- 返回
index structs
- 返回类型
List[IndexStruct]
- persist(persist_path: str = './storage/index_store.json', fs: Optional[AbstractFileSystem] = None) None
Persist the store.