Commit 6b98e8cb authored by Nikola Milojevic's avatar Nikola Milojevic

Merge branch 'remove-similarity-search-ff' into 'master'

Remove the similarity_search feature flag

See merge request gitlab-org/gitlab!67310
parents 1e84bc12 992270b9
---
name: similarity_search
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/37300/
rollout_issue_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/38675
milestone: '13.3'
type: development
group: group::optimize
default_enabled: true
...@@ -288,11 +288,8 @@ Parameters: ...@@ -288,11 +288,8 @@ Parameters:
| `with_security_reports` | boolean | no | **(ULTIMATE)** Return only projects that have security reports artifacts present in any of their builds. This means "projects with security reports enabled". Default is `false` | | `with_security_reports` | boolean | no | **(ULTIMATE)** Return only projects that have security reports artifacts present in any of their builds. This means "projects with security reports enabled". Default is `false` |
1. Order by similarity: Orders the results by a similarity score calculated from the provided `search` 1. Order by similarity: Orders the results by a similarity score calculated from the provided `search`
URL parameter. This is an [alpha](https://about.gitlab.com/handbook/product/gitlab-the-product/#alpha) feature [introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/221043) in GitLab 13.3. URL parameter. When using `order_by=similarity`, the `sort` parameter is ignored. When the `search`
parameter is not provided, the API returns the projects ordered by `name`.
The feature is behind a feature flag, you can [enable it](../administration/feature_flags.md#enable-or-disable-the-feature)
with the `similarity_search` flag. When using `order_by=similarity` the `sort` parameter is
ignored. When the `search` parameter is not provided, the API returns the projects ordered by `name`.
Example response: Example response:
......
...@@ -137,7 +137,7 @@ module API ...@@ -137,7 +137,7 @@ module API
# rubocop: disable CodeReuse/ActiveRecord # rubocop: disable CodeReuse/ActiveRecord
def handle_similarity_order(group, projects) def handle_similarity_order(group, projects)
if params[:search].present? && Feature.enabled?(:similarity_search, group, default_enabled: true) if params[:search].present?
projects.sorted_by_similarity_desc(params[:search]) projects.sorted_by_similarity_desc(params[:search])
else else
order_options = { name: :asc } order_options = { name: :asc }
......
...@@ -965,23 +965,6 @@ RSpec.describe API::Groups do ...@@ -965,23 +965,6 @@ RSpec.describe API::Groups do
expect(project_names).to eq(['Project', 'Test', 'Test Project']) expect(project_names).to eq(['Project', 'Test', 'Test Project'])
end end
end end
context 'when `similarity_search` feature flag is off' do
before do
stub_feature_flags(similarity_search: false)
end
it 'returns items ordered by name' do
subject
expect(response).to have_gitlab_http_status(:ok)
expect(response).to include_pagination_headers
expect(json_response.length).to eq(2)
project_names = json_response.map { |proj| proj['name'] }
expect(project_names).to eq(['Test', 'Test Project'])
end
end
end end
it "returns the group's projects with simple representation" do it "returns the group's projects with simple representation" do
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment