Skip to content

Document Filter Question #530

@bnuzhanyu

Description

@bnuzhanyu

I want to filter some docs in an executor, and found a solution here:
https://docarray.jina.ai/fundamentals/documentarray/access-elements/#index-by-boolean-mask

There are two questions:

  1. Is this the only way to filter document offered by docarray?
  2. There seems a wrong description here.
    Note that if the length of the boolean mask is smaller than the length of a DocumentArray, then the remaining part is padded to False.
    It seems the True masked doc will be removed and smaller boolean mask is padding with True.

Test code :

da = DocumentArray.empty(3)
mask = [True, False] # has same behave with [True, False, True]
del da[mask]
print(len(da))  # got 1

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions