Inedo Community Forums Forums
    • Recent
    • Tags
    • Popular
    • Login

    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

    Scheduled Pinned Locked Moved Support
    proget
    6 Posts 1 Posters 233 Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • ? This user is from outside of this forum
      Guest
      last edited by

      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

      1 Reply Last reply Reply Quote 0
      • ? This user is from outside of this forum
        Guest
        last edited by

        It should work if you swap the parameters of substringof:

        substringof(Tags,'TESTTAG')
        
        1 Reply Last reply Reply Quote 0
        • ? This user is from outside of this forum
          Guest
          last edited by

          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?

          1 Reply Last reply Reply Quote 0
          • ? This user is from outside of this forum
            Guest
            last edited by

            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.

            1 Reply Last reply Reply Quote 0
            • ? This user is from outside of this forum
              Guest
              last edited by

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

              1 Reply Last reply Reply Quote 0
              • ? This user is from outside of this forum
                Guest
                last edited by

                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.

                1 Reply Last reply Reply Quote 0

                Hello! It looks like you're interested in this conversation, but you don't have an account yet.

                Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

                With your input, this post could be even better šŸ’—

                Register Login
                • 1 / 1
                • First post
                  Last post
                Inedo Website Home • Support Home • Code of Conduct • Forums Guide • Documentation