public function actionAjaxload()
 {
     $is_urlencoded = TRUE;
     $params = $this->resolve_request_vars($is_urlencoded);
     extract($params);
     $solr = new DealModel();
     try {
         $solr_data = $solr->queryWithSpellCheck($query, $query_options, $rows, $offset);
         $solr_result = $solr_data->response;
     } catch (Exception $e) {
         $solr_result = NULL;
         //echo $e->getMessage();
         return;
     }
     foreach ($solr_result->docs as $d) {
         $d = DealProcessor::process($d);
     }
     echo json_encode(array("numFound" => $solr_result->numFound, "docs" => $solr_result->docs));
     Yii::app()->end();
 }
Esempio n. 2
0
 public function run()
 {
     if ($this->register_script) {
         $this->script_init();
     }
     if (!$this->solr_result) {
         echo "Deal block has not been initialized";
         return;
     }
     $dealblocks = '';
     if ($this->solr_result->numFound) {
         foreach ($this->solr_result->docs as $doc) {
             $doc = DealProcessor::process($doc);
             $vars = array('doc' => $doc, 'has_highlighting' => $this->highlighting ? TRUE : FALSE, 'highlighting' => $this->highlighting ? $this->highlighting->{$doc->id} : NULL);
             $dealblocks .= $this->render("{$this->layout}_item", $vars, TRUE);
         }
     } else {
         $dealblocks = $this->render('empty_deal', array('suggestion' => $this->termSuggestion), TRUE);
     }
     echo $dealblocks;
 }
Esempio n. 3
0
 protected function renderDealList($query_options)
 {
     $solr = new DealModel();
     $query = '*:*';
     $rows = 10;
     $offset = 0;
     try {
         $solr_result = $solr->query($query, $query_options, $rows, $offset);
     } catch (Exception $e) {
         $solr_result = NULL;
         echo $e->getMessage();
     }
     $dealblocks = '';
     if ($solr_result->numFound) {
         foreach ($solr_result->docs as $doc) {
             $doc = DealProcessor::process($doc);
             $description = $doc->description;
             $dealblocks .= $this->render("TopDealBlock", array('doc' => $doc, 'description' => $description), TRUE);
         }
     }
     return $dealblocks;
 }