Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor(types): move add_chunk add_match to Set #1343

Merged
merged 10 commits into from
Nov 24, 2020
Merged

Conversation

hanxiao
Copy link
Member

@hanxiao hanxiao commented Nov 24, 2020

Breaking Change #1337

  • add_chunk and add_match are removed
  • Refactor Document with the newly introduced classes, including UniqueId, ChunkSet, DocumentSet, MatchSet

@hanxiao hanxiao requested a review from a team as a code owner November 24, 2020 12:41
@jina-bot jina-bot added size/M area/core This issue/PR affects the core codebase area/helper This issue/PR affects the helper functionality area/testing This issue/PR affects testing component/driver component/type labels Nov 24, 2020
jina/types/document/uid.py Show resolved Hide resolved
jina/types/document/uid.py Show resolved Hide resolved
jina/drivers/rank.py Outdated Show resolved Hide resolved
@codecov
Copy link

codecov bot commented Nov 24, 2020

Codecov Report

Merging #1343 (84d57cc) into master (79064e6) will increase coverage by 0.14%.
The diff coverage is 91.20%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1343      +/-   ##
==========================================
+ Coverage   83.25%   83.39%   +0.14%     
==========================================
  Files         101      103       +2     
  Lines        6717     6812      +95     
==========================================
+ Hits         5592     5681      +89     
- Misses       1125     1131       +6     
Impacted Files Coverage Δ
jina/types/request/__init__.py 91.89% <72.00%> (-4.15%) ⬇️
jina/types/document/uid.py 84.74% <78.94%> (-2.76%) ⬇️
jina/drivers/craft.py 100.00% <100.00%> (ø)
jina/drivers/evaluate.py 98.21% <100.00%> (+0.03%) ⬆️
jina/drivers/index.py 95.00% <100.00%> (ø)
jina/drivers/rank.py 97.22% <100.00%> (+0.34%) ⬆️
jina/drivers/search.py 94.73% <100.00%> (+0.09%) ⬆️
jina/excepts.py 100.00% <100.00%> (ø)
jina/types/document/__init__.py 96.87% <100.00%> (+0.29%) ⬆️
jina/types/querylang/__init__.py 90.47% <100.00%> (+1.08%) ⬆️
... and 34 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 c596897...84d57cc. Read the comment docs.

@hanxiao hanxiao merged commit f3a7c15 into master Nov 24, 2020
@hanxiao hanxiao deleted the refactor-doc-set branch November 24, 2020 16:13
@nan-wang
Copy link
Member

Right now, there are two functions for adding a chunk/match to the document. I'd suggest removing add().

There should be one-- and preferably only one --obvious way to do it.
The Zen of Python

with Document() as d:
    c1 = d.chunks.append()
    c1.id = f'1:0>16'
    c2 = d.chunks.add()
    c2.id = f'2:0>16'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/core This issue/PR affects the core codebase area/helper This issue/PR affects the helper functionality area/testing This issue/PR affects testing component/driver component/type size/M
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants