Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'app/models/project.rb')
-rw-r--r--app/models/project.rb15
1 files changed, 5 insertions, 10 deletions
diff --git a/app/models/project.rb b/app/models/project.rb
index e276bd2422d..5a3f591c2e7 100644
--- a/app/models/project.rb
+++ b/app/models/project.rb
@@ -273,8 +273,9 @@ class Project < ActiveRecord::Base
scope :pending_delete, -> { where(pending_delete: true) }
scope :without_deleted, -> { where(pending_delete: false) }
- scope :with_hashed_storage, -> { where('storage_version >= 1') }
- scope :with_legacy_storage, -> { where(storage_version: [nil, 0]) }
+ scope :with_storage_feature, ->(feature) { where('storage_version >= :version', version: HASHED_STORAGE_FEATURES[feature]) }
+ scope :without_storage_feature, ->(feature) { where('storage_version < :version OR storage_version IS NULL', version: HASHED_STORAGE_FEATURES[feature]) }
+ scope :with_unmigrated_storage, -> { where('storage_version < :version OR storage_version IS NULL', version: LATEST_STORAGE_VERSION) }
scope :sorted_by_activity, -> { reorder(last_activity_at: :desc) }
scope :sorted_by_stars, -> { reorder('projects.star_count DESC') }
@@ -425,17 +426,11 @@ class Project < ActiveRecord::Base
#
# query - The search query as a String.
def search(query)
- pattern = to_pattern(query)
-
- where(
- arel_table[:path].matches(pattern)
- .or(arel_table[:name].matches(pattern))
- .or(arel_table[:description].matches(pattern))
- )
+ fuzzy_search(query, [:path, :name, :description])
end
def search_by_title(query)
- non_archived.where(arel_table[:name].matches(to_pattern(query)))
+ non_archived.fuzzy_search(query, [:name])
end
def visibility_levels