Conditional posts in WP_query for search

What about removing the if statement, and combining the queries into something like this:

'meta_query',
array(
'relation' => 'OR',
    array(
        array(
            'relation' => 'AND',
                array(
                    'key' => 'am_get_recurring_count',
                    'compare' => '=',
                    'value' => '0',
                ),
                array(
                    'relation' => 'OR',
                    array(
                         'key' => 'am_enddate',
                         'compare' => '>=',
                         'value' => $currentdate,
                    ),
                    array(
                         'key' => 'am_enddate',
                         'compare' => 'NOT EXISTS',
                        )
                )
        )
    )
    array(
        array(
            'relation' => 'AND',
                array(
                    'key' => 'am_get_recurring_count',
                    'compare' => '!=',
                    'value' => '0',
                ),
                array(
                    'relation' => 'OR',
                    array(
                         'key' => 'am_enddate',
                         'compare' => 'NOT EXISTS',
                    ),
                    array(
                        'relation' => 'AND',
                        array(
                             'key' => 'am_enddate',
                             'compare' => '>=',
                             'value' => $currentdate,
                        ),
                        array(
                             'key' => 'am_enddate',
                             'compare' => '<=',
                             'value' => $enddate,
                        )
                    )
                )
        )

   )

 )

Haven’t had a chance to test this yet. Please let me know if it works.