Commit 4af69aab authored by Nick Thomas's avatar Nick Thomas

Rubocop fixups

parent 0670055f
...@@ -6,4 +6,3 @@ module Elasticsearch ...@@ -6,4 +6,3 @@ module Elasticsearch
module Git module Git
end end
end end
...@@ -10,7 +10,7 @@ require 'open3' ...@@ -10,7 +10,7 @@ require 'open3'
module Elasticsearch module Elasticsearch
module Git module Git
module Repository module Repository
class CreateIndexException < StandardError; end CreateIndexException = Class.new(StandardError)
BLOBS_BATCH = 100 BLOBS_BATCH = 100
COMMMITS_BATCH = 500 COMMMITS_BATCH = 500
...@@ -196,7 +196,7 @@ module Elasticsearch ...@@ -196,7 +196,7 @@ module Elasticsearch
out, err, status = Open3.capture3("git log #{range} --format=\"%H\"", chdir: repository_for_indexing.path) out, err, status = Open3.capture3("git log #{range} --format=\"%H\"", chdir: repository_for_indexing.path)
if status.success? && err.blank? if status.success? && err.blank?
#TODO use rugged walker!!! # TODO: use rugged walker!!!
commit_oids = out.split("\n") commit_oids = out.split("\n")
commit_oids.each_slice(COMMMITS_BATCH) do |batch| commit_oids.each_slice(COMMMITS_BATCH) do |batch|
...@@ -393,7 +393,7 @@ module Elasticsearch ...@@ -393,7 +393,7 @@ module Elasticsearch
module ClassMethods module ClassMethods
def search(query, type: :all, page: 1, per: 20, options: {}) def search(query, type: :all, page: 1, per: 20, options: {})
results = { blobs: [], commits: []} results = { blobs: [], commits: [] }
case type.to_sym case type.to_sym
when :all when :all
...@@ -430,7 +430,7 @@ module Elasticsearch ...@@ -430,7 +430,7 @@ module Elasticsearch
} }
if query.blank? if query.blank?
query_hash[:query][:bool][:must] = { match_all: {}} query_hash[:query][:bool][:must] = { match_all: {} }
query_hash[:track_scores] = true query_hash[:track_scores] = true
end end
...@@ -481,7 +481,7 @@ module Elasticsearch ...@@ -481,7 +481,7 @@ module Elasticsearch
simple_query_string: { simple_query_string: {
query: query, query: query,
default_operator: :and, default_operator: :and,
fields: [ 'blob.content', 'blob.file_name' ] fields: %w[blob.content blob.file_name]
} }
} }
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment