Skip to content

Commit

Permalink
Merge branch 'ep_bulk_timeout' into 'beta'
Browse files Browse the repository at this point in the history
ep bulk timeout increase

See merge request WordPress/plugin-hacks!10
  • Loading branch information
Helmut Januschka committed Jan 18, 2019
2 parents 5610540 + e164fa4 commit ceef4a6
Showing 1 changed file with 24 additions and 4 deletions.
28 changes: 24 additions & 4 deletions src/Core.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,13 @@ public function add_filters()
{
}

public function ep_bulk_index_posts_request_args($args, $body)
{
$args['timeout'] = 300000;

return $args;
}

public function add_actions()
{
//Disable ACF fields that are from DB - improves performance a lot
Expand All @@ -45,6 +52,11 @@ public function add_actions()
add_filter('ep_formatted_args', [$this, 'ep_formatted_args'], 1, 1);
add_filter('ep_index_post_request_args', [$this, 'ep_index_post_request_args'], 1, 2);
add_filter('ep_index_post_request_path', [$this, 'ep_index_post_request_path'], 1, 2);
add_filter('ep_bulk_index_posts_request_args', [$this, 'ep_bulk_index_posts_request_args'], 10, 2);

//workaround: https://github.com/10up/ElasticPress/pull/1158
add_filter('ep_post_sync_args', [$this, 'ep_post_sync_args'], 10, 2);

/// ELASITC PRESS

add_filter('acp/filtering/cache/seconds', function ($seconds) {
Expand Down Expand Up @@ -104,6 +116,14 @@ public function add_actions()
});
}

public function ep_post_sync_args($args, $post_id)
{
$args['comment_status'] = absint($args['comment_status']);
$args['ping_status'] = absint($args['ping_status']);

return $args;
}

//ACF querie disable
//
public function debug_enabled()
Expand Down Expand Up @@ -184,10 +204,10 @@ public function ep_formatted_args($args)
$new['query_string'] = $new['multi_match'];
$new['query_string']['query'] = $this->wildCardIt($new['query_string']['query']);
$new['query_string']['query'] = str_replace(
['\\', '+', '-', '&', '|', '!', '(', ')', '{', '}', '[', ']', '^', '~', '?', ':'],
['\\\\', "\+", "\-", "\&", "\|", "\!", "\(", "\)", "\{", "\}", "\[", "\]", "\^", "\~", "\?", "\:"],
$new['query_string']['query']
);
['\\', '+', '-', '&', '|', '!', '(', ')', '{', '}', '[', ']', '^', '~', '?', ':'],
['\\\\', "\+", "\-", "\&", "\|", "\!", "\(", "\)", "\{", "\}", "\[", "\]", "\^", "\~", "\?", "\:"],
$new['query_string']['query']
);
$new['query_string']['analyze_wildcard'] = true;
unset($new['query_string']['type']);
$new['query_string']['fields'] = ['post_title'];
Expand Down

0 comments on commit ceef4a6

Please sign in to comment.