you can break these lines out of the if entirely since they're identical in both the if and else parts.. ie.
```
		$posts_query = ORM::factory('Post')
			->distinct(TRUE)
			->where('type', '=', $this->_type)
			->order_by($this->_record_orderby, $this->_record_order);

		$set_id = $this->request->query('set');
		if ( ! empty($set_id))
		{
			$posts_query->join('posts_sets', 'INNER')
				->on('post.id', '=', 'posts_sets.post_id')
				->where('posts_sets.set_id', '=', $set_id);
		}
```