diff options
author | Valery Sizov <valery@gitlab.com> | 2016-02-05 18:20:29 +0200 |
---|---|---|
committer | Valery Sizov <valery@gitlab.com> | 2016-02-05 18:20:29 +0200 |
commit | 94af78ac4a7a0b76eb370a22320ee6410b6a4695 (patch) | |
tree | 6ff098bccfa2bbbbc2063287ca4cf8c0e316ed68 /app/helpers/snippets_helper.rb | |
parent | 569c4672033701c0cf89c9fc8f031507c5f7af6c (diff) | |
download | gitlab-ce-94af78ac4a7a0b76eb370a22320ee6410b6a4695.tar.gz |
Faster snippet search
Diffstat (limited to 'app/helpers/snippets_helper.rb')
-rw-r--r-- | app/helpers/snippets_helper.rb | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/app/helpers/snippets_helper.rb b/app/helpers/snippets_helper.rb index bc36434f549..41ae4048992 100644 --- a/app/helpers/snippets_helper.rb +++ b/app/helpers/snippets_helper.rb @@ -33,7 +33,7 @@ module SnippetsHelper # surrounding code. # # @returns Array, unique and sorted. - def matching_lines(lined_content, surrounding_lines) + def matching_lines(lined_content, surrounding_lines, query) used_lines = [] lined_content.each_with_index do |line, line_number| used_lines.concat bounded_line_numbers( @@ -51,9 +51,9 @@ module SnippetsHelper # surrounding_lines() worth of unmatching lines. # # @returns a hash with {snippet_object, snippet_chunks:{data,start_line}} - def chunk_snippet(snippet, surrounding_lines = 3) + def chunk_snippet(snippet, query, surrounding_lines = 3) lined_content = snippet.content.split("\n") - used_lines = matching_lines(lined_content, surrounding_lines) + used_lines = matching_lines(lined_content, surrounding_lines, query) snippet_chunk = [] snippet_chunks = [] |