Welcome to the Inedo Forums! Check out the Forums Guide for help getting started.
If you are experiencing any issues with the forum software, please visit the Contact Form on our website and let us know!
Nuget v3 SearchQueryService does not support query terms
-
With a v3 feed, using
nuget.exe search
with any query terms always returns no hits (at least from all my testing), even when there should be hits. For example, the following returns no hits even when the feed contains a package with idsomeid
:nuget search id:someid -prerelease
Inspecting with Fiddler, this translates to a request like:
GET http://xxx/nuget/test/v3/search?q=ID:someid&skip=0&take=20&prerelease=true&semVerLevel=2.0.0 HTTP/1.1
to which proget responds:
{ "totalHits": 0, "data": [] }
An equivalent query directed at
nuget.org
works as expected. The relevant nuget server API is documented here and here.I've tried a variety of query terms, and it seems that if any query terms are present, the search will find no hits.
This does kind of work with the v2 API, if the feed is configured to allow v2, but it is very slow even with search terms that should translate to a no-brainer indexed db query, for example
packageid:Newtonsoft.JSON version:11.0.2
. I recently updated to ProGet 5.3.34 (from 5.1.x) in the hope that this would be properly sorted out with the v3 API, but instead it appears to be completely non-functional.
-
Hello,
Can you provide some specific reproduction instructions?
For example, I create a request like yours (but using
Inedo
and our ProGet server), and it produces results:Thanks,
Alana
-
Hi Alana,
I just do:
nuget search ID:mycompany -source http://xxx/nuget/internal/v3/index.json -prerelease
(where 'mycompany' is replaced with a string that occurs in the ID of many of our internal packages). And I just get zero hits, with the traced HTTP request and response as shown in my original post. There's nothing in the ProGet server logs. Unless I'm missing something obvious, if it works for you, then it seems that this must be down to some platform, configuration or environment difference on the ProGet side. Is there some more ProGet diagnostics I can turn on? Could it be related to the type or configuration of the backing database?
Thanks,
Tom
UPDATE: I tried setting
Diagnostics.MinimumLogLevel
to zero, and indeed I can see more log events in the UI, but none that appear connected to when I issue a search request.
-
Hi @tomg_5321 ,
Looking at the code real quick, it seems that when performing searches against a local package store, ProGet does not parse the query in the same way nuget.org does (i.e. using filters).
Instead, if the search string (
ID:mycompany
in your case) exists within the Id, Title, or Tags, it's returned. I don't think that string exists, butmycompany
must.Can you try doing
nuget search mycompany ...
instead?Thanks,
Alana
-
Hi @atripp,
Yes,
nuget search mycompany ...
does return results.However, my actual underlying requirement is to test if a certain version (which may not be the most recent) of a certain package (by exact id) exists on the server, in an efficient way, for use over relatively low-performance network links (ie, not over local LAN). So ideally this should be a server-side query. As it stands. I can run this kind of search against
nuget.org
, but not ProGet.Thanks,
Tom
-
Hi @tomg_5321
Glad you can get some results using the non-filtered search. If there is more demand, we may implement it... but you're the first person mention it.
However, based on your requirements, I don't think you should use search..
my actual underlying requirement is to test if a certain version (which may not be the most recent) of a certain package (by exact id) exists on the server, in an efficient way, for use over relatively low-performance network links (ie, not over local LAN)
In this case, I recommend you just do a
HEAD
request on this URL:/nuget/<feed-name>/v3/catalog/<package-name>/<version>.json
For example in PowerShell,
Invoke-WebRequest -Method Head https://proget.inedo.com/nuget/NuGetLibraries/v3/catalog/inedo.buildmaster.sdk/2.0.0.json
A
200
means package exist, a404
means it doesn't exist.Cheers,
Alana