How To Create A Search Panel

My Model is basically coming out of a view , e.g


$model=Yii::app()->db->createCommand('SELECT * FROM vCustomer')->queryAll();

Now I want to ensure that when the data is searched, it should filter out the $model based on search


public function actionIndex()

	{

		// renders the view file 'protected/views/site/index.php'

		// using the default layout 'protected/views/layouts/main.php'

		// $this->render('index');

		$model=new Vessel('search');

		$model->unsetAttributes();  // clear any default values

		if(isset($_GET['Vessel']))

			$model->attributes=$_GET['Vessel'];


		$this->render('index',array(

			'model'=>$model,

		));

	}

Anyone encountered similar problems?