Display related post based on post content and post title

Hello,

I'm using theme build in related post plugin which display related post based on category. I'm finding solution for display related post based on post content and post title instead.

This is the post-related.php file.

I see this part of code decide post display based on category.

wp_reset_query();
		$categories = get_the_category($post->ID);

		if ($categories) {
			$category_ids = array();
			foreach($categories as $individual_category) $category_ids[] = $individual_category->term_id;

			$args=array(
				'category__in' => $category_ids,
				'post__not_in' => array($post->ID),
				'showposts'=>3,
				'ignore_sticky_posts'=>1,
				'orderby' => 'rand'
			);

Anyways to change it to search related post based on post title or post content?

Thank you,
Tuan

p/s: i know that we have a lot of related post plugin out there, but i want to use build in function for optimize site speed.