Skip to content

Commit

Permalink
Replace hard-coded check to allow list check
Browse files Browse the repository at this point in the history
  • Loading branch information
sathyapulse committed Nov 29, 2024
1 parent 0e291f5 commit 9eb8a1b
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions search/includes/classes/class-search.php
Original file line number Diff line number Diff line change
Expand Up @@ -2234,7 +2234,7 @@ public function do_not_sync_if_no_index( $kill, $indexable_slug ) {
/**
* Do not sync if no index exists for post.
*
* Skip triggering index exists check for _edit_lock meta key.
* Skip triggering index exists check for _edit_lock meta key by checking meta allow list.
* Less requests made to the ES server.
* @see https://github.com/10up/ElasticPress/pull/1899
*
Expand All @@ -2246,11 +2246,15 @@ public function do_not_sync_if_no_index( $kill, $indexable_slug ) {
* @return bool
*/
public function do_not_sync_if_no_index_for_post( $kill, $post, $meta_id, $meta_key ) {
if ( '_edit_lock' === $meta_key ) {
$indexable = \ElasticPress\Indexables::factory()->get( 'post' );
if (
$indexable &&
! ( empty( $object_id ) && $indexable->sync_manager->delete_all_meta ) &&
! $indexable->is_meta_allowed( $meta_key, $post )
) {
return true;
}

$indexable = \ElasticPress\Indexables::factory()->get( 'post' );
if ( $indexable && ! $indexable->index_exists() ) {
$kill = true;
}
Expand Down

0 comments on commit 9eb8a1b

Please sign in to comment.