Skip to content

feat: support update for inmemory index #1725

@jupyterjazz

Description

@jupyterjazz

InMemoryExactNNIndex does not support update

from docarray.index import InMemoryExactNNIndex
from docarray import BaseDoc

class MyDoc(BaseDoc):
    text: str


data = [MyDoc(text=f'text {i}') for i in range(10)]
doc_index = InMemoryExactNNIndex[MyDoc]()
doc_index.index(data)

assert doc_index.num_docs() == 10

for doc in data:
    doc.text = doc.text + 'smth'

doc_index.index(data)

assert doc_index.num_docs() == 10

Instead of updating the same 10 docs, it would extend existing docs with the same 10 docs.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

Status

Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions