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
4af69aab
Commit
4af69aab
authored
May 03, 2017
by
Nick Thomas
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Rubocop fixups
parent
0670055f
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
6 additions
and
7 deletions
+6
-7
lib/elasticsearch/git.rb
lib/elasticsearch/git.rb
+0
-1
lib/elasticsearch/git/lite_blob.rb
lib/elasticsearch/git/lite_blob.rb
+1
-1
lib/elasticsearch/git/repository.rb
lib/elasticsearch/git/repository.rb
+5
-5
No files found.
lib/elasticsearch/git.rb
View file @
4af69aab
...
...
@@ -6,4 +6,3 @@ module Elasticsearch
module
Git
end
end
lib/elasticsearch/git/lite_blob.rb
View file @
4af69aab
...
...
@@ -12,7 +12,7 @@ module Elasticsearch
def
initialize
(
repo
,
raw_blob_hash
)
@id
=
raw_blob_hash
[
:oid
]
@blob
=
repo
.
lookup
(
@id
)
@blob
=
repo
.
lookup
(
@id
)
@mode
=
raw_blob_hash
[
:mode
].
to_s
(
8
)
@size
=
@blob
.
size
...
...
lib/elasticsearch/git/repository.rb
View file @
4af69aab
...
...
@@ -10,7 +10,7 @@ require 'open3'
module
Elasticsearch
module
Git
module
Repository
class
CreateIndexException
<
StandardError
;
end
CreateIndexException
=
Class
.
new
(
StandardError
)
BLOBS_BATCH
=
100
COMMMITS_BATCH
=
500
...
...
@@ -196,7 +196,7 @@ module Elasticsearch
out
,
err
,
status
=
Open3
.
capture3
(
"git log
#{
range
}
--format=
\"
%H
\"
"
,
chdir:
repository_for_indexing
.
path
)
if
status
.
success?
&&
err
.
blank?
#
TODO
use rugged walker!!!
#
TODO:
use rugged walker!!!
commit_oids
=
out
.
split
(
"
\n
"
)
commit_oids
.
each_slice
(
COMMMITS_BATCH
)
do
|
batch
|
...
...
@@ -393,7 +393,7 @@ module Elasticsearch
module
ClassMethods
def
search
(
query
,
type: :all
,
page:
1
,
per:
20
,
options:
{})
results
=
{
blobs:
[],
commits:
[]}
results
=
{
blobs:
[],
commits:
[]
}
case
type
.
to_sym
when
:all
...
...
@@ -430,7 +430,7 @@ module Elasticsearch
}
if
query
.
blank?
query_hash
[
:query
][
:bool
][
:must
]
=
{
match_all:
{}}
query_hash
[
:query
][
:bool
][
:must
]
=
{
match_all:
{}
}
query_hash
[
:track_scores
]
=
true
end
...
...
@@ -481,7 +481,7 @@ module Elasticsearch
simple_query_string:
{
query:
query
,
default_operator: :and
,
fields:
[
'blob.content'
,
'blob.file_name'
]
fields:
%w[blob.content blob.file_name
]
}
}
}
...
...
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