I have several RAW repositories (because the built-in types don’t work for what I’m trying to accomplish), with an enforced beginning structure:
I am using the REST API to search for specific name and version using the ‘q’ search parameters (service/rest/v1/search/assets?repository=myRepo&q="/myName/0.0.1/"), but I get back more results that I expected.
For instance, let’s say I have the following in the artifact repository:
When I search for “/myName/0.0.1/” (notice, I in the REST example above, I quoted the
q parameter, so it should have been an exact search), the results I get include only
myName, but versions: ‘0.0.1’, ‘0.0.1-preRelease1’, ‘0.0.1-asdf’.
I expected that using the “exact” search I would have only gotten
myName ‘0.0.1’ (and anything nested directly below that name/version combo).
It seems like the majority of the search features just don’t work for raw type repositories. What am I doing wrong?
I don’t believe quotes will perform an exact match.
You should be able to use group like:
using “group” returns no results.
And I would mention that removing quotes from the value of “q” returns too many results. I had previously talked to Sonatype support and they were the ones that said I needed to quote the value passed in to the
q parameter to perform an exact search.
When I don’t quote the value passed into
q, I would get all the entries in the entire repository (even ones that don’t match the “name” or “version” (because I think the raw repos don’t use “group” or “version” property fields).
No trailing slash on the group
I tried that as well, and it still didn’t work.
I ended up with this grammar for searching which returned the results I expected:
without the ‘*’ in the group parameter, I would not get any results. If I didn’t include the trailing slash, then I would get
0.0.1, 0.0.1-blah, 0.0.1+45, 0.0.1-moreBlah (basically, anything prefixed with 0.0.1).
Since I wanted a specific version, I needed to include the trailing slash, but I wanted all assets below that point (hence the * after the trailing /).
Anyways, I think I have a grammar that works and is predictable.