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

Don't suggest resources #1714

Merged
merged 3 commits into from
Jan 11, 2024
Merged

Don't suggest resources #1714

merged 3 commits into from
Jan 11, 2024

Conversation

javitonino
Copy link
Contributor

Description

Avoid returning suggestions that match a prefix search on the resource ID (can happen under normal use for UUIDs & searches starting with a-f)

How was this PR tested?

Describe how you tested this PR.

@CLAassistant
Copy link

CLAassistant commented Jan 10, 2024

CLA assistant check
All committers have signed the CLA.

Copy link

codecov bot commented Jan 10, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (4f6c442) 82.15% compared to head (03f9535) 82.19%.
Report is 2 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1714      +/-   ##
==========================================
+ Coverage   82.15%   82.19%   +0.04%     
==========================================
  Files         334      334              
  Lines       19489    19535      +46     
==========================================
+ Hits        16011    16057      +46     
  Misses       3478     3478              
Flag Coverage Δ
ingest 69.11% <ø> (-0.15%) ⬇️
node-sidecar 95.62% <ø> (ø)
nucliadb 70.41% <ø> (+0.09%) ⬆️
reader 79.02% <ø> (ø)
sdk 40.46% <ø> (ø)
search 79.09% <ø> (-0.15%) ⬇️
standalone 88.27% <ø> (ø)
train 63.76% <ø> (ø)
utils 81.25% <ø> (ø)
writer 85.15% <ø> (-0.07%) ⬇️

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

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Comment on lines 350 to 364
// Any type that is not Resource (avoid suggesting resource UUIDs)
node_filters: vec![
RelationNodeFilter {
node_type: NodeType::Entity.into(),
..Default::default()
},
RelationNodeFilter {
node_type: NodeType::Label.into(),
..Default::default()
},
RelationNodeFilter {
node_type: NodeType::User.into(),
..Default::default()
},
],
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think that the expectation for this feature is that only entities are suggested.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤔 That makes sense for me as well, should we confirm it with someone else? Or just change it to filter only entities?

Copy link
Contributor

@lferran lferran Jan 10, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yup, good idea. let me confirm with @ebrehault (a.k.a: our API chief!)

Copy link
Contributor Author

@javitonino javitonino Jan 10, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As another data point: the current tests check that Users are also suggested, but I think it might be a mistake since the comments explicitly mention entities. It's probably just copypasting what the function returned as the expected value without double-checking.

P.S: I still think returning only entities is the right thing to do here.

@@ -345,7 +347,21 @@ impl ShardReader {
shard_id: String::default(), // REVIEW: really?
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since you are modifying this part of the code, do you mind removing this line? Is not necessary since we use ..Default::default() at the end.

@javitonino javitonino force-pushed the 8271-dont-suggest-resources branch 2 times, most recently from af4060a to 03f9535 Compare January 11, 2024 09:06
Copy link
Contributor

@lferran lferran left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice first contribution to NucliaDB @javitonino 👏🏼 for many more 🍾

@javitonino javitonino merged commit de67e3d into main Jan 11, 2024
104 of 105 checks passed
@javitonino javitonino deleted the 8271-dont-suggest-resources branch January 11, 2024 09:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants