parent
6425b6ae1d
commit
dcfb1529ea
@ -82,6 +82,12 @@ class AlgoliaSearchErrorHandler
|
||||
return 'check_key_acl_to_tmp_index'
|
||||
end
|
||||
|
||||
# Pushed record is above the 10KB limit
|
||||
if error['http_error'] == 400 &&
|
||||
error['json']['message'] =~ /^Record is too big/
|
||||
return 'record_too_big'
|
||||
end
|
||||
|
||||
false
|
||||
end
|
||||
end
|
||||
|
||||
@ -121,6 +121,23 @@ describe(AlgoliaSearchErrorHandler) do
|
||||
expect(actual).to eq('check_key_acl_to_tmp_index')
|
||||
end
|
||||
|
||||
it 'should warn about big records' do
|
||||
# Given
|
||||
parsed = {
|
||||
'http_error' => 400,
|
||||
'json' => {
|
||||
'message' => 'Record is too big size=220062 bytes'
|
||||
}
|
||||
}
|
||||
allow(@error_handler).to receive(:parse_algolia_error).and_return(parsed)
|
||||
|
||||
# When
|
||||
actual = @error_handler.readable_algolia_error('error')
|
||||
|
||||
# Then
|
||||
expect(actual).to eq('record_too_big')
|
||||
end
|
||||
|
||||
it 'should return false if no nice message found' do
|
||||
# Given
|
||||
parsed = false
|
||||
|
||||
19
txt/record_too_big
Normal file
19
txt/record_too_big
Normal file
@ -0,0 +1,19 @@
|
||||
Algolia Error: Record too big
|
||||
Records pushed to Algolia have a max possible size of 10KB. Records above this
|
||||
limit will be rejected.
|
||||
|
||||
You see this error because at least one of the records the plugin is trying to
|
||||
push is above this limit.
|
||||
|
||||
The plugin creates a record for each `<p>` paragraph of text found in your
|
||||
pages. If one of them contains a huge chunk of text it may trigger this error.
|
||||
|
||||
You can configure the CSS selector used to create records through the
|
||||
`record_css_selector` option. The default is `p` (meaning all `<p>`
|
||||
paragraphs). You can update this value to use a negation selector to exclude
|
||||
some parts.
|
||||
|
||||
For example `p:not(.do-not-index)` will only index paragraphs that do not have
|
||||
the class `do-not-index`.
|
||||
|
||||
See https://github.com/algolia/algoliasearch-jekyll for more information
|
||||
Loading…
x
Reference in New Issue
Block a user