Create a post automatically if search result has zero results

Assuming you are using the standard WordPress search, you can get the searched number with get_search_query

So this code will create a new draft post if no results were found for the search:

        $match = get_page_by_title( sanitize_title( get_search_query() ), OBJECT, ['post_type' => 'post'] );
        if ( empty( $match ) ) {
            wp_insert_post(
                ['post_title' => sanitize_title( get_search_query() ) ]
            );
        }

The above snippet would be added to the search.php template in your theme.