Commit 73a3bc83 authored by Terri Chu's avatar Terri Chu Committed by charlie ablett

Support displaying indexed filenames for large files

parent 019cc163
......@@ -7,5 +7,12 @@
= search_blob_title(project, path)
= copy_file_path_button(path)
- if blob.data
- if blob.data.size > 0
.file-content.code.term{ data: { qa_selector: 'file_text_content' } }
= render 'shared/file_highlight', blob: blob, first_line_number: blob.startline, blob_link: blob_link, highlight_line: blob.highlight_line
- else
.file-content.code
.nothing-here-block
.gl-text-gray-600.gl-font-sm
- max_file_size_indexed = Gitlab::CurrentSettings.elasticsearch_indexed_file_size_limit_kb.kilobytes
= _('The file could not be displayed because it is empty or larger than the maximum file size indexed (%{size}).') % { size: number_to_human_size(max_file_size_indexed) }
......@@ -626,8 +626,8 @@ Reports that go over the 20 MB limit won't be loaded. Affected reports:
> [Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/8638) in GitLab 13.3.
You can set a limit on the content of repository files that are indexed in
Elasticsearch. Any files larger than this limit is neither indexed
nor searchable.
Elasticsearch. Any files larger than this limit only index the file name.
The file content is neither indexed nor searchable.
Setting a limit helps reduce the memory usage of the indexing processes and
the overall index size. This value defaults to `1024 KiB` (1 MiB) as any
......
......@@ -109,7 +109,7 @@
= f.label :elasticsearch_indexed_file_size_limit_kb, _('Maximum file size indexed (KiB)'), class: 'label-bold'
= f.number_field :elasticsearch_indexed_file_size_limit_kb, value: @application_setting.elasticsearch_indexed_file_size_limit_kb, class: 'form-control gl-form-input'
.form-text.gl-text-gray-600.gl-mt-0
= _('Any files larger than this limit will not be indexed, and thus will not be searchable.')
= _('Any files larger than this limit only index the file name. The file content is neither indexed nor searchable.')
.form-group
= f.label :elasticsearch_indexed_field_length_limit, _('Maximum field length'), class: 'label-bold'
......
......@@ -370,10 +370,15 @@ RSpec.describe Gitlab::Elastic::Indexer do
index_repository(project)
end
it 'does not index that file' do
it 'indexes the file with empty content' do
files = indexed_file_paths_for('file')
expect(files).to include('small_file.txt')
expect(files).not_to include('large_file.txt')
expect(files).to include('small_file.txt', 'large_file.txt')
blobs = Repository.elastic_search('large_file', type: 'blob')[:blobs][:results].response
large_file_blob = blobs.find do |blob|
'large_file.txt' == blob['_source']['blob']['path']
end
expect(large_file_blob['_source']['blob']['content']).to eq('')
end
end
......
......@@ -3903,7 +3903,7 @@ msgstr ""
msgid "Any encrypted tokens"
msgstr ""
msgid "Any files larger than this limit will not be indexed, and thus will not be searchable."
msgid "Any files larger than this limit only index the file name. The file content is neither indexed nor searchable."
msgstr ""
msgid "Any label"
......@@ -32831,6 +32831,9 @@ msgstr ""
msgid "The file containing the export is not available yet; it may still be transferring. Please try again later."
msgstr ""
msgid "The file could not be displayed because it is empty or larger than the maximum file size indexed (%{size})."
msgstr ""
msgid "The file has been successfully created."
msgstr ""
......
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