Exemple #1
0
 public function indexAction()
 {
     $query = $this->_getParam('query');
     if ($this->_getParam('contacts')) {
         $this->searchContacts($this->_getParam('query'));
         return;
     }
     $hits = $this->searchService->search($query);
     $this->view->results = $this->filterResults($hits);
     $this->view->query = $query;
     $this->view->perPage = 6;
     if ($this->_getParam('_ajax')) {
         $this->renderRawView('search/results.php');
     } else {
         $this->renderView('search/results.php');
     }
 }
 private function _process()
 {
     $filter = array('categories' => $this->_getSelectedCategories(Input::get('categories')), 'min' => Input::get('min'), 'max' => Input::get('max'));
     $keywords = Input::get('keywords');
     try {
         $result = SearchService::search(Config::get('constants.SEARCH.ITEM'), $keywords, $filter);
         return Response::json(array('success_code' => 'OK', 'data' => $result->toArray()), 200);
     } catch (Exception $exception) {
         return Response::json(array('error_code' => $exception->getCode(), 'error_message' => $exception->getMessage()), 500);
     }
 }
 protected function getSearchResults ()
 {
     $searchService = new SearchService ($this->searchOptions);
     $results = $searchService->search ();
     
     foreach ($results as $rss)
     {
         $this->searchResults = array_merge($this->searchResults, $rss->items);
     }
     
     $this->totalResults = count ($this->searchResults);
     
     if ($this->totalResults > 0)
     {
         $this->sort ($this->sort);
     }
 }       
 public function search($argv)
 {
     $searchService = new SearchService();
     if ($argv[0] === './repose') {
         array_shift($argv);
         // $argv[0]  repose script
         array_shift($argv);
         // $argv[1]  search cmd
     }
     $return = array_shift($argv);
     // $argv[2]  return mode    (show|return)
     $unit = array_shift($argv);
     // $argv[3]  unit to search ('all'|'disk'|'volume'|'collection'):name
     $terms = $argv;
     // remainder is terms (key:matchval)
     $searchService->search(compact('return', 'unit', 'terms'));
 }
<?
	require ('../Util/SearchUtil.php');
	require ('../Service/SearchService.php');
	
	$options = array (
			'query' => 'Gibson "les paul"',
			'minAsk' => 20000,
		);
	
	$domains = array ('sfbay', 'newyork');
	$type = 'msg';

	$ss = new SearchService ($options, $type, $domains);
	$ss->search ();
	
	$options['query'] = '"Les  paul" giBSON';
	$ss = new SearchService ($options, $type, $domains);
	$ss->search ();	
?>