Improve wildcard search for conan package name and version
-
Please check this box if this contribution uses AI-generated content (including content generated by GitLab Duo features) as outlined in the GitLab DCO & CLA. As a benefit of being a GitLab Community Contributor, you receive complimentary access to GitLab Duo.
What does this MR do and why?
Improve wildcard search for conan package name and version. This fixes part of #507340 (closed). The wildcards for username and channel will be handled in another mr.
We were unsure if we need to add another index to the database since we added the with_version_like search on the package.
Co-Authored-By: @oceane_scania
References
How to set up and validate locally
Supposing you have a conan remote called "gitlab-local" pointing to your local gitlab project. If not, you can set it up following the documentations: https://docs.gitlab.com/ee/user/packages/conan_repository/#add-a-remote-for-your-project
-
Create a new conan package
mkdir searchTestpkg && cd searchTestpkg conan new searchTest/1.2.3@gitlab-org+conan/stable --template=cmake_lib conan create . gitlab-org+conan/stable -
Upload the package
conan upload searchTest/1.2.3@gitlab-org+conan/stable -r gitlab-local --all -
Search for the package
conan search s*chT*t/1.*.3@gitlab-org+conan/stable -r gitlab-localConan should return:
Existing package recipes: searchTest/1.2.3@gitlab-org+conan/stable -
Validate error handling
Long search term:
conan search "qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq" -r gitlab-localConan should return:
ERROR: {"message":"Search term length must be less than 200 characters."}. [Remote: gitlab-local]Too many wildcards in search term:
conan search "al*h*/*@*nn*/*" -r gitlab-localConan should return:
ERROR: {"message":"Too many wildcards in search term. Maximum is 5."}. [Remote: gitlab-local]
Related to #507340 (closed)