<?php defined('SYSPATH') or die('No direct script access.');

class Controller_Search extends Controller {

    public function action_do_search(){
        
        $this->action_build_index();
        $this->action_search("a");
    }

    public function action_build_index()
    {
        $sales = ORM::factory('sale')->find_all();
        Search::instance()->build_search_index($sales);
    }

    public function action_search($query)
    {
        //$query  = Arr::get($_GET, 'query');
        $results = Search::instance()->find($query);
        
        $view   = View::factory('search')   ->bind('results', $results);
        
        var_dump($results);
        //$this->request->response = $view;
    }

}
