Skip to content

feat: find method #93

Merged
hanxiao merged 43 commits intomainfrom
feat-find
Feb 7, 2022
Merged

feat: find method #93
hanxiao merged 43 commits intomainfrom
feat-find

Conversation

@davidbp
Copy link
Copy Markdown
Contributor

@davidbp davidbp commented Feb 3, 2022

#86

This PR provides .find method that should return the closest limit docs leveraging the search,find,query methods from the correspoonding storage backends (in case they exist)

Example

from docarray import DocumentArray, Document
import numpy as np
embeddings = np.random.random((100,128))

da = DocumentArray(storage='weaviate')
da.extend([Document(embedding=v) for v  in embeddings])

print(da.find(da[5, 'embedding'], limit=10))
print(da.find(da[5:8, 'embedding'], limit=20))

Prints

<DocumentArray (length=10) at 140604081691184>
[<DocumentArray (length=20) at 140604081751472>, <DocumentArray (length=20) at 140604213025568>, <DocumentArray (length=20) at 140604213062672>]

@davidbp davidbp changed the title feat: find method weaviate feat: find method Feb 3, 2022
@codecov
Copy link
Copy Markdown

codecov bot commented Feb 3, 2022

Codecov Report

Merging #93 (1d5f5d7) into main (bd343d8) will decrease coverage by 33.37%.
The diff coverage is 32.82%.

Impacted file tree graph

@@             Coverage Diff             @@
##             main      #93       +/-   ##
===========================================
- Coverage   85.24%   51.87%   -33.38%     
===========================================
  Files          98      100        +2     
  Lines        4386     4465       +79     
===========================================
- Hits         3739     2316     -1423     
- Misses        647     2149     +1502     
Flag Coverage Δ
docarray 51.87% <32.82%> (-33.38%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
docarray/array/mixins/io/common.py 28.57% <0.00%> (-38.10%) ⬇️
docarray/array/mixins/io/json.py 47.50% <0.00%> (-45.00%) ⬇️
docarray/array/mixins/plot.py 8.42% <ø> (-56.51%) ⬇️
docarray/array/storage/pqlite/__init__.py 0.00% <0.00%> (-100.00%) ⬇️
docarray/array/storage/pqlite/find.py 0.00% <0.00%> (ø)
docarray/array/storage/pqlite/getsetdel.py 0.00% <0.00%> (-96.83%) ⬇️
docarray/array/storage/pqlite/seqlike.py 0.00% <0.00%> (-75.00%) ⬇️
docarray/array/storage/weaviate/__init__.py 0.00% <0.00%> (-100.00%) ⬇️
docarray/array/storage/weaviate/backend.py 0.00% <0.00%> (-87.74%) ⬇️
docarray/array/storage/weaviate/find.py 0.00% <0.00%> (ø)
... and 81 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 46f80d6...1d5f5d7. Read the comment docs.

@github-actions github-actions bot added size/m and removed size/s labels Feb 3, 2022
@github-actions github-actions bot added size/l and removed size/m labels Feb 4, 2022
@hanxiao hanxiao merged commit b032047 into main Feb 7, 2022
@hanxiao hanxiao deleted the feat-find branch February 7, 2022 19:32
alaeddine-13 added a commit to generall/docarray that referenced this pull request Feb 8, 2022
Co-authored-by: Alaeddine Abdessalem <[email protected]>
Co-authored-by: Han Xiao <[email protected]>
@hanxiao hanxiao mentioned this pull request Feb 22, 2022
21 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants