How to filter ACF post object field/search by custom field?

I have a front end ACF form - acf_form(). With a post object field. I want to limit the queried results by a custom field. The code below works, except for when i try to type in the search bar - a get the following errors: The errors I am getting are PHP errors in ajax response;

0: "PhpConsole\Handler->handleError()"

1: "strpos()"

2: "acf_order_by_search()"

3: "acf_field_post_object->get_ajax_query()"

4: "acf_field_post_object->ajax_query()"

5: "do_action('wp_ajax_acf/fields/post_object/query')"

Also getting "Undefined index: s" and "strpos(): Empty needle"

My code:

function filter_customer_doc_query( $args, $field, $post_id ) {
  $user_id_doc = get_current_user_id();
  $business_id_doc = get_field('user_business_id', 'user_' . $user_id_doc);
  $args = array(
    'posts_per_page' => 10,
    'post_type'     => 'customer',
    'meta_key'      => 'customer_business_id',
    'meta_value'    => $business_id_doc,
  );
  return $args;
}
add_filter('acf/fields/post_object/query/name=doc_customer_object', 'filter_customer_doc_query', 10, 3);

Solution 1:

Solved it by replacing $args above with:

$args['meta_query'] = array(
    array(
        'key'       => 'customer_business_id',
        'value' => $business_id_doc,
        'compare' => '=',
    )
);