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!

Filter=substringof is not working



  • Accessing the ProGet package feed with
    http://192.168.216.1:25602/nuget/Packages()/$count?$filter=substringof('TESTTAG',Tags)
    always returns zero packages, although some packages with Tag TESTTAG are available within the feed.
    Is this kind of request not implemented in ProGet or is this a misconfiguration of my server?

    Product: ProGet
    Version: 3.7.6



  • It should work if you swap the parameters of substringof:

    substringof(Tags,'TESTTAG')


  • Thank you for the response.
    I can confirm, that swapping the parameter provides the correct result with ProGet.
    But this seems to be an incompatibility of ProGet with other NuGet Servers.
    I'm using the NuGet core DLL to access different NuGet repositories, namely the NuGet Gallery, the NuGet server, and a ProGet server.
    The access code looks like this:

    IPackageRepository nuGetPackageRepository = PackageRepositoryFactory.Default.CreateRepository(nuGetPackageSource);
    IQueryable<IPackage> query = nuGetPackageRepository.GetPackages();
    query = query.Where(p => p.Tags.Contains("TESTTAG"));
    int searchCount = query.Count();
    

    From this code sequence, the NuGet core DLL generates the aforementioned GET request

    filter=substringof('TESTTAG',Tags)
    

    which is incompatible to ProGet due to the parameter swapping.

    Will this be fixed in future ProGet versions or do you consider this as a problem of NuGet core DLL?



  • The OData spec is a little vague on this, but I think the NuGet implementation is correct. And regardless, ProGet is supposed to be compatible with NuGet's feeds, so we'd need to change it to match anyway.

    We'll get this fixed in a maintenance release. In the meantime you can either keep swapping the arguments for ProGet or try using the indexof function instead:

    filter=indexof(Tags,'TESTTAG') gt -1
    

    That should be functionally equivalent.



  • Thank you for the confirmation. I will wait for the maintenance release.



  • After updating to ProGet 3.8.1 the query

    http://192.168.216.1:25602/nuget/Packages()/$count?$filter=substringof('TESTTAG',Tags) 
    

    now works as expected.
    Fixed by

    • PG-441 - FIX: substringof OData function arguments should be swapped

    Thanks.


Log in to reply
 

Inedo Website HomeSupport HomeCode of ConductForums GuideDocumentation