Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
06e3a1b5
Commit
06e3a1b5
authored
Jul 23, 2020
by
Douglas Barbosa Alexandre
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add method to search for a list of uploads
parent
c12d9e8f
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
1 deletion
+13
-1
ee/app/models/ee/upload.rb
ee/app/models/ee/upload.rb
+12
-0
ee/app/models/geo/upload_registry.rb
ee/app/models/geo/upload_registry.rb
+1
-1
No files found.
ee/app/models/ee/upload.rb
View file @
06e3a1b5
...
@@ -9,6 +9,8 @@ module EE
...
@@ -9,6 +9,8 @@ module EE
extend
ActiveSupport
::
Concern
extend
ActiveSupport
::
Concern
prepended
do
prepended
do
include
::
Gitlab
::
SQL
::
Pattern
after_destroy
:log_geo_deleted_event
after_destroy
:log_geo_deleted_event
scope
:for_model
,
->
(
model
)
{
where
(
model_id:
model
.
id
,
model_type:
model
.
class
.
name
)
}
scope
:for_model
,
->
(
model
)
{
where
(
model_id:
model
.
id
,
model_type:
model
.
class
.
name
)
}
...
@@ -21,6 +23,16 @@ module EE
...
@@ -21,6 +23,16 @@ module EE
selective_sync_scope
(
node
).
merge
(
object_storage_scope
(
node
))
selective_sync_scope
(
node
).
merge
(
object_storage_scope
(
node
))
end
end
# Searches for a list of uploads based on the query given in `query`.
#
# On PostgreSQL this method uses "ILIKE" to perform a case-insensitive
# search.
#
# query - The search query as a String.
def
search
(
query
)
fuzzy_search
(
query
,
[
:path
])
end
private
private
# @return [ActiveRecord::Relation<Upload>] scope observing object storage settings of the given node
# @return [ActiveRecord::Relation<Upload>] scope observing object storage settings of the given node
...
...
ee/app/models/geo/upload_registry.rb
View file @
06e3a1b5
...
@@ -45,7 +45,7 @@ class Geo::UploadRegistry < Geo::BaseRegistry
...
@@ -45,7 +45,7 @@ class Geo::UploadRegistry < Geo::BaseRegistry
def
self
.
with_search
(
query
)
def
self
.
with_search
(
query
)
return
all
if
query
.
nil?
return
all
if
query
.
nil?
where
(
file_id:
Geo
::
Fdw
::
Upload
.
search
(
query
)
)
where
(
file_id:
Upload
.
search
(
query
).
limit
(
1000
).
pluck_primary_key
)
end
end
def
self
.
with_status
(
status
)
def
self
.
with_status
(
status
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment