How to search only by post title and category?

You’ll have to write a custom WP_Query in search.php.

Also since you want to search in post_title + categories, you might have to run 2 separate queries and merge results of them into 1.

Something like:

$q1 = get_posts(array(
    'post_type' => 'post',
    'post_status' => 'publish',
    'posts_per_page' => '-1',
    's' => get_search_query()
));
$q2 = get_posts(array(
    'post_type' => 'post',
    'post_status' => 'publish',
    'posts_per_page' => '-1',
    'tax_query' => array(
        //YOUR tax query here
    )
));
$merged = array_merge( $q1, $q2 );

And use $merged to show your results.

Also you can also use WPDB to achieve this using MySQL query.