Skip to content

Bug: DocIndex search fails when it's empty #1530

@jupyterjazz

Description

@jupyterjazz
import numpy as np
from docarray import BaseDoc
from docarray.index import InMemoryExactNNIndex
from docarray.typing import NdArray
from pydantic import parse_obj_as


class MyDoc(BaseDoc):
    emb: NdArray


index = InMemoryExactNNIndex[MyDoc]()
query = parse_obj_as(NdArray, np.random.rand(5))
docs, _ = index.find(query, search_field="emb", limit=10)
ValueError: need at least one array to stack

Metadata

Metadata

Assignees

Labels

type/bugSomething isn't working

Type

No type

Projects

Status

Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions