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
9c42e1d1
Commit
9c42e1d1
authored
Jan 19, 2016
by
Valery Sizov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ES: all comments addressed
parent
ad2b85c4
Changes
9
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
23 additions
and
20 deletions
+23
-20
app/elastic/application_search.rb
app/elastic/application_search.rb
+4
-1
app/elastic/merge_requests_search.rb
app/elastic/merge_requests_search.rb
+6
-13
app/elastic/repositories_search.rb
app/elastic/repositories_search.rb
+4
-1
app/elastic/wiki_repositories_search.rb
app/elastic/wiki_repositories_search.rb
+4
-1
app/models/issue.rb
app/models/issue.rb
+1
-0
app/models/project.rb
app/models/project.rb
+1
-1
doc/integration/elasticsearch.md
doc/integration/elasticsearch.md
+0
-2
lib/gitlab/elastic/project_search_results.rb
lib/gitlab/elastic/project_search_results.rb
+2
-0
lib/gitlab/elastic/search_results.rb
lib/gitlab/elastic/search_results.rb
+1
-1
No files found.
app/elastic/application_search.rb
View file @
9c42e1d1
...
...
@@ -4,7 +4,10 @@ module ApplicationSearch
included
do
include
Elasticsearch
::
Model
self
.
__elasticsearch__
.
client
=
Elasticsearch
::
Client
.
new
host:
Gitlab
.
config
.
elasticsearch
.
host
,
port:
Gitlab
.
config
.
elasticsearch
.
port
self
.
__elasticsearch__
.
client
=
Elasticsearch
::
Client
.
new
(
host:
Gitlab
.
config
.
elasticsearch
.
host
,
port:
Gitlab
.
config
.
elasticsearch
.
port
)
index_name
[
Rails
.
application
.
class
.
parent_name
.
downcase
,
self
.
name
.
downcase
,
Rails
.
env
].
join
(
'-'
)
...
...
app/elastic/merge_requests_search.rb
View file @
9c42e1d1
...
...
@@ -49,20 +49,13 @@ module MergeRequestsSearch
if
options
[
:projects_ids
]
query_hash
[
:query
][
:filtered
][
:filter
]
=
{
and:
[{
or:
[
{
terms:
{
source_project_id:
[
options
[
:projects_ids
]].
flatten
}
},
{
terms:
{
target_project_id:
[
options
[
:projects_ids
]].
flatten
}
and:
[
{
terms:
{
target_project_id:
[
options
[
:projects_ids
]].
flatten
}
]
}
]
}
]
}
end
...
...
app/elastic/repositories_search.rb
View file @
9c42e1d1
...
...
@@ -4,7 +4,10 @@ module RepositoriesSearch
included
do
include
Elasticsearch
::
Git
::
Repository
self
.
__elasticsearch__
.
client
=
Elasticsearch
::
Client
.
new
host:
Gitlab
.
config
.
elasticsearch
.
host
,
port:
Gitlab
.
config
.
elasticsearch
.
port
self
.
__elasticsearch__
.
client
=
Elasticsearch
::
Client
.
new
(
host:
Gitlab
.
config
.
elasticsearch
.
host
,
port:
Gitlab
.
config
.
elasticsearch
.
port
)
def
repository_id
project
.
id
...
...
app/elastic/wiki_repositories_search.rb
View file @
9c42e1d1
...
...
@@ -4,7 +4,10 @@ module WikiRepositoriesSearch
included
do
include
Elasticsearch
::
Git
::
Repository
self
.
__elasticsearch__
.
client
=
Elasticsearch
::
Client
.
new
host:
Gitlab
.
config
.
elasticsearch
.
host
,
port:
Gitlab
.
config
.
elasticsearch
.
port
self
.
__elasticsearch__
.
client
=
Elasticsearch
::
Client
.
new
(
host:
Gitlab
.
config
.
elasticsearch
.
host
,
port:
Gitlab
.
config
.
elasticsearch
.
port
)
def
repository_id
"wiki_
#{
project
.
id
}
"
...
...
app/models/issue.rb
View file @
9c42e1d1
...
...
@@ -41,6 +41,7 @@ class Issue < ActiveRecord::Base
scope
:cared
,
->
(
user
)
{
where
(
assignee_id:
user
)
}
scope
:open_for
,
->
(
user
)
{
opened
.
assigned_to
(
user
)
}
scope
:in_projects
,
->
(
project_ids
)
{
where
(
project_id:
project_ids
)
}
state_machine
:state
,
initial: :opened
do
event
:close
do
...
...
app/models/project.rb
View file @
9c42e1d1
...
...
@@ -944,7 +944,7 @@ class Project < ActiveRecord::Base
end
def
wiki
ProjectWiki
.
new
(
self
,
self
.
owner
)
@wiki
||=
ProjectWiki
.
new
(
self
,
self
.
owner
)
end
def
reference_issue_tracker?
...
...
doc/integration/elasticsearch.md
View file @
9c42e1d1
...
...
@@ -38,8 +38,6 @@ Elasticsearch is a flexible, scalable and powerful search service. It will keep
For installation from source:
For GitHub.com:
```
elasticsearch:
enabled: true
...
...
lib/gitlab/elastic/project_search_results.rb
View file @
9c42e1d1
...
...
@@ -56,6 +56,7 @@ module Gitlab
if
project
.
empty_repo?
||
query
.
blank?
Kaminari
.
paginate_array
([])
else
# We use elastic for default branch only
if
root_ref?
project
.
repository
.
search
(
query
,
...
...
@@ -94,6 +95,7 @@ module Gitlab
if
project
.
empty_repo?
||
query
.
blank?
Kaminari
.
paginate_array
([])
else
# We use elastic for default branch only
if
root_ref?
project
.
repository
.
find_commits_by_message_with_elastic
(
query
)
else
...
...
lib/gitlab/elastic/search_results.rb
View file @
9c42e1d1
...
...
@@ -67,7 +67,7 @@ module Gitlab
}
if
query
=~
/#(\d+)\z/
Issue
.
where
(
project_id:
limit_project_ids
).
where
(
iid:
$1
)
Issue
.
in_projects
(
limit_project_ids
).
where
(
iid:
$1
)
else
Issue
.
elastic_search
(
query
,
options:
opt
)
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