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

feat(search): update search pattern matching rules #1257

Conversation

laurentiuNiculae
Copy link
Contributor

What type of PR is this?

Which issue does this PR fix:
#909

What does this PR do / Why do we need it:

If an issue # is not available please add repro steps and logs showing the issue:

Testing done on this change:

Automation added to e2e:

Will this break upgrades or downgrades?

Does this PR introduce any user-facing change?:


By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@laurentiuNiculae laurentiuNiculae force-pushed the repodb-search-pattern-matching-update branch from 96d3763 to 73edc8e Compare March 10, 2023 15:46
@codecov
Copy link

codecov bot commented Mar 10, 2023

Codecov Report

Merging #1257 (9216ed1) into main (a2c3480) will increase coverage by 0.00%.
The diff coverage is 100.00%.

❗ Current head 9216ed1 differs from pull request most recent head 5c403e0. Consider uploading reports for the commit 5c403e0 to get more accurate results

@@           Coverage Diff           @@
##             main    #1257   +/-   ##
=======================================
  Coverage   90.38%   90.39%           
=======================================
  Files          96       96           
  Lines       21324    21332    +8     
=======================================
+ Hits        19273    19282    +9     
+ Misses       1537     1536    -1     
  Partials      514      514           
Impacted Files Coverage Δ
pkg/extensions/search/common/oci_layout.go 91.08% <ø> (-0.07%) ⬇️
pkg/extensions/search/convert/repodb.go 97.59% <ø> (-0.02%) ⬇️
pkg/meta/repodb/boltdb-wrapper/boltdb_wrapper.go 89.29% <100.00%> (ø)
pkg/meta/repodb/common.go 100.00% <100.00%> (ø)
pkg/meta/repodb/common/common.go 98.19% <100.00%> (+0.84%) ⬆️
pkg/meta/repodb/dynamodb-wrapper/dynamo_wrapper.go 92.61% <100.00%> (ø)

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@laurentiuNiculae laurentiuNiculae marked this pull request as ready for review March 13, 2023 08:33
@laurentiuNiculae laurentiuNiculae force-pushed the repodb-search-pattern-matching-update branch from 73edc8e to f1c2ad8 Compare March 13, 2023 10:57
@rchincha rchincha requested a review from raulkele March 13, 2023 17:19
andaaron
andaaron previously approved these changes Mar 14, 2023
pkg/meta/repodb/common/common.go Show resolved Hide resolved
pkg/meta/repodb/common/common.go Outdated Show resolved Hide resolved
@laurentiuNiculae laurentiuNiculae force-pushed the repodb-search-pattern-matching-update branch from f1c2ad8 to 5eac34a Compare March 15, 2023 15:02
@laurentiuNiculae laurentiuNiculae force-pushed the repodb-search-pattern-matching-update branch 5 times, most recently from 7047a4e to 7f2911a Compare March 17, 2023 10:10
@rchincha
Copy link
Contributor

So what is the overall logic for ranking? image:tag first, repo names, and any wildcards? We should eventually also allow searching within annotations. This use case is coming up often.

go.mod Outdated Show resolved Hide resolved
@andaaron
Copy link
Contributor

andaaron commented Mar 17, 2023

So what is the overall logic for ranking? image:tag first, repo names, and any wildcards? We should eventually also allow searching within annotations. This use case is coming up often.

  • If a tag is specified (:), the search string for the repo needs to be an exact match. That is a tag search, not a repo search. The logic for that was not changed in this PR.
  • If a : is not specified, the repo string is compared to the search string according to the new comments in this PR.

We did not decide on any wildcard, or annotation searches to my knowledge.
At the moment the presence of : signals if this is a repo or a tag search.

What would be a good example of a string the user sends as an annotation search? How would the servers know that is an annotation search, not a repo or a tag search?

Actually I am not convinced searches by annotations are a good idea: which annotations?, on the manifest itself?, on an index?, on descriptors inside a manifest or index?, by annotation key? by annotation value?, by an annotation value on a specific key?

Why would I want to search on an annotation anyway? What is the use case?

@laurentiuNiculae laurentiuNiculae force-pushed the repodb-search-pattern-matching-update branch from 7f2911a to 6ce6541 Compare March 20, 2023 11:25
Copy link
Contributor

@andaaron andaaron left a comment

Choose a reason for hiding this comment

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

Looks good, please rebase.

@laurentiuNiculae laurentiuNiculae force-pushed the repodb-search-pattern-matching-update branch 2 times, most recently from 83b5d7c to b217fb9 Compare March 21, 2023 12:43
andaaron
andaaron previously approved these changes Mar 21, 2023
Copy link
Contributor

@andaaron andaaron left a comment

Choose a reason for hiding this comment

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

It's good to see we removed score from the graphql api, as we had no benefit in exposing it.

@laurentiuNiculae laurentiuNiculae force-pushed the repodb-search-pattern-matching-update branch from b217fb9 to 4ca6437 Compare March 21, 2023 14:48
@laurentiuNiculae laurentiuNiculae force-pushed the repodb-search-pattern-matching-update branch 3 times, most recently from 19d65d5 to 2b482ca Compare March 22, 2023 15:46
andaaron
andaaron previously approved these changes Mar 22, 2023
Signed-off-by: Laurentiu Niculae <niculae.laurentiu1@gmail.com>
Copy link
Contributor

@rchincha rchincha left a comment

Choose a reason for hiding this comment

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

lgtm

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

3 participants