Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IndexHelper: handle the output of an array of messages #2688

Merged
merged 2 commits into from
Mar 28, 2022

Conversation

felipeelia
Copy link
Member

Description of the Change

In some cases, IndexHelper will try to output an array of messages related to the same error. This PR takes that array and transforms it back into a string.

Verification Process

  • Add the following code to a website:
add_filter(
	'ep_prepare_meta_data',
	function( $post_meta, $post ) {
		for ( $i = 0; $i < 100; $i++ ) {
			$post_meta[ "test_meta_{$i}_title_{$post->ID}" ] = 'Lorem';
			$post_meta[ "test_meta_{$i}_body_{$post->ID}" ]  = 'Ipsum';
		}
		return $post_meta;
	},
	10,
	2
);

Normally, it'd make the index fail due to [illegal_argument_exception] Limit of total fields [5000] in index [domain-post-1] has been exceeded error if the user executes wp elasticpress index --setup --yes --show-errors. With the code in the PR, the error is properly outputted, instead of silently failing.

Changelog Entry

Fixed: Handle the output of an array of messages in sync processes.

Credits

Props @felipeelia

@felipeelia felipeelia merged commit acdd653 into develop Mar 28, 2022
@felipeelia felipeelia deleted the fix/index-helper-handle-msg-array branch March 28, 2022 20:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants