Prerelease flag doesn't work in the nuget search API

Summary

Using Visual Studio, in the Manage NuGet Packages screen, the Show pre-release packages checkbox doesn't work as expected.

Steps to reproduce

  1. Setup GitLab as a NuGet source as described in https://docs.gitlab.com/ee/user/packages/nuget_repository/index.html#adding-the-gitlab-nuget-repository-as-a-source-to-nuget
  2. $ dotnet new console --name NugetBug.
  3. $ cd NugetBug.
  4. $ open NugetBug.csproj.
  5. Right click on Dependencies in the tree view and select Manage NuGet Packages.
  6. In the opening modal, select the GitLab source.
  7. Search for a package with a pre release version (eg. has a - in the version number).
  8. Checking or not the Show pre-release packages checkbox doesn't have any effect: the pre release version is always shown.

What is the current bug behavior?

With the Show pre-release packages checkbox ticked: Screenshot_2020-02-19_at_10.32.50

Without the Show pre-release packages checkbox ticked: Screenshot_2020-02-19_at_10.32.58

-> the version 9.6.1-alpha is always shown.

What is the expected correct behavior?

The pre release version are not listed when the Show pre-release packages checkbox not ticked.

Output of checks

This bug happens on GitLab.com

Possible fixes

It might be possible that default option for including pre release version is take into account too aggressively and thus it is applied all the time: https://gitlab.com/gitlab-org/gitlab/-/blob/master/ee/app/services/packages/nuget/search_service.rb#L13.

In all cases, it should be really easy to fix it.