diff options
Diffstat (limited to 'app/finders/projects_finder.rb')
-rw-r--r-- | app/finders/projects_finder.rb | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/app/finders/projects_finder.rb b/app/finders/projects_finder.rb index 471029c1ef9..14b84d0bfa6 100644 --- a/app/finders/projects_finder.rb +++ b/app/finders/projects_finder.rb @@ -50,7 +50,12 @@ class ProjectsFinder < UnionFinder use_cte = params.delete(:use_cte) collection = Project.wrap_with_cte(collection) if use_cte collection = filter_projects(collection) - sort(collection) + + if params[:sort] == 'similarity' && params[:search] && Feature.enabled?(:project_finder_similarity_sort) + collection.sorted_by_similarity_desc(params[:search]) + else + sort(collection) + end end private @@ -209,7 +214,11 @@ class ProjectsFinder < UnionFinder end def sort(items) - params[:sort].present? ? items.sort_by_attribute(params[:sort]) : items.projects_order_id_desc + if params[:sort].present? + items.sort_by_attribute(params[:sort]) + else + items.projects_order_id_desc + end end def by_archived(projects) |