Skip to content

TextDoc not easily indexable with InMemory and HNSWLib #1695

@JoanFM

Description

@JoanFM

Initial Checks

  • I have read and followed the docs and still think this is a bug

Description

It is not easy to index and search building a basic NN search application on TextDoc or ImageDoc

Example Code

from docarray.documents import TextDoc
from docarray.index.backends.in_memory import InMemoryExactNNIndex
from docarray.index.backends.hnswlib import HnswDocumentIndex
import numpy as np


index = HnswDocumentIndex[TextDoc]() # one or the other
index = InMemoryExactNNIndex[TextDoc]() # one or the other

docs = [TextDoc(text='hey', embedding=np.random.rand(128)) for i in range(200)]
index.index(docs)
index.find_batched(docs[0:10], search_field='embedding')

Python, Pydantic & OS Version

0.35.0

Affected Components

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    Status
    Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions