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
4feece80
Commit
4feece80
authored
Jul 25, 2016
by
Valery Sizov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix pagination on search result page when ES search is enabled
parent
06a166a2
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
60 additions
and
7 deletions
+60
-7
CHANGELOG-EE
CHANGELOG-EE
+1
-0
lib/gitlab/elastic/project_search_results.rb
lib/gitlab/elastic/project_search_results.rb
+1
-1
lib/gitlab/elastic/search_results.rb
lib/gitlab/elastic/search_results.rb
+4
-4
lib/gitlab/elastic/snippet_search_results.rb
lib/gitlab/elastic/snippet_search_results.rb
+2
-2
spec/features/projects/elastic/global_search_spec.rb
spec/features/projects/elastic/global_search_spec.rb
+46
-0
spec/spec_helper.rb
spec/spec_helper.rb
+1
-0
spec/support/search_helpers.rb
spec/support/search_helpers.rb
+5
-0
No files found.
CHANGELOG-EE
View file @
4feece80
...
...
@@ -4,6 +4,7 @@ v 8.11.0 (unreleased)
v 8.10.2 (unreleased)
- Dicouple an ES index update from RepositoryUpdateMirrorWorker
- Fix pagination on search result page when ES search is enabled
v 8.10.1
- No EE-specific changes
...
...
lib/gitlab/elastic/project_search_results.rb
View file @
4feece80
...
...
@@ -21,7 +21,7 @@ module Gitlab
def
objects
(
scope
,
page
=
nil
)
case
scope
when
'notes'
notes
.
records
.
page
(
page
).
per
(
per_page
)
notes
.
page
(
page
).
per
(
per_page
).
records
when
'blobs'
blobs
.
page
(
page
).
per
(
per_page
)
when
'wiki_blobs'
...
...
lib/gitlab/elastic/search_results.rb
View file @
4feece80
...
...
@@ -16,13 +16,13 @@ module Gitlab
def
objects
(
scope
,
page
=
nil
)
case
scope
when
'projects'
projects
.
records
.
page
(
page
).
per
(
per_page
)
projects
.
page
(
page
).
per
(
per_page
).
records
when
'issues'
issues
.
records
.
page
(
page
).
per
(
per_page
)
issues
.
page
(
page
).
per
(
per_page
).
records
when
'merge_requests'
merge_requests
.
records
.
page
(
page
).
per
(
per_page
)
merge_requests
.
page
(
page
).
per
(
per_page
).
records
when
'milestones'
milestones
.
records
.
page
(
page
).
per
(
per_page
)
milestones
.
page
(
page
).
per
(
per_page
).
records
else
Kaminari
.
paginate_array
([])
end
...
...
lib/gitlab/elastic/snippet_search_results.rb
View file @
4feece80
...
...
@@ -9,9 +9,9 @@ module Gitlab
def
objects
(
scope
,
page
=
nil
)
case
scope
when
'snippet_titles'
snippet_titles
.
records
.
page
(
page
).
per
(
per_page
)
snippet_titles
.
page
(
page
).
per
(
per_page
).
records
when
'snippet_blobs'
snippet_blobs
.
records
.
page
(
page
).
per
(
per_page
)
snippet_blobs
.
page
(
page
).
per
(
per_page
).
records
else
super
end
...
...
spec/features/projects/elastic/global_search_spec.rb
0 → 100644
View file @
4feece80
require
'spec_helper'
feature
'Global elastic search'
,
feature:
true
do
let
(
:user
)
{
create
(
:user
)
}
let
(
:project
)
{
create
(
:project
,
namespace:
user
.
namespace
)
}
before
do
stub_application_setting
(
elasticsearch_search:
true
,
elasticsearch_indexing:
true
)
project
.
team
<<
[
user
,
:master
]
login_with
(
user
)
end
after
do
stub_application_setting
(
elasticsearch_search:
false
,
elasticsearch_indexing:
false
)
end
describe
'I search through the issues and I see pagination'
do
before
do
[
::
Project
,
Issue
,
MergeRequest
,
Milestone
].
each
do
|
model
|
model
.
__elasticsearch__
.
create_index!
end
create_list
(
:issue
,
21
,
project:
project
,
title:
'initial'
)
Issue
.
__elasticsearch__
.
refresh_index!
end
after
do
[
::
Project
,
Issue
,
MergeRequest
,
Milestone
].
each
do
|
model
|
model
.
__elasticsearch__
.
delete_index!
end
end
it
"has a pagination"
do
visit
dashboard_projects_path
fill_in
"search"
,
with:
"initial"
click_button
"Go"
select_filter
(
"Issues"
)
expect
(
page
).
to
have_selector
(
'.gl-pagination .page'
,
count:
2
)
end
end
end
spec/spec_helper.rb
View file @
4feece80
...
...
@@ -31,6 +31,7 @@ RSpec.configure do |config|
config
.
include
Devise
::
TestHelpers
,
type: :controller
config
.
include
LoginHelpers
,
type: :feature
config
.
include
LoginHelpers
,
type: :request
config
.
include
SearchHelpers
,
type: :feature
config
.
include
StubConfiguration
config
.
include
EmailHelpers
config
.
include
TestEnv
...
...
spec/support/search_helpers.rb
0 → 100644
View file @
4feece80
module
SearchHelpers
def
select_filter
(
name
)
find
(
:xpath
,
"//ul[contains(@class, 'search-filter')]//a[contains(.,'
#{
name
}
')]"
).
click
end
end
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