public function actionLocationDeals($center, $radius) { $solr = new DealModel(); try { $solr_result = $solr->getDealsFromLocation($center, $radius); } catch (Exception $e) { echo "unable to query deals from location"; } echo json_encode($solr_result); Yii::app()->end(); }
public function actionAjaxDeals($center, $radius) { $is_urlencoded = TRUE; $params = $this->resolve_map_request_vars($is_urlencoded); extract($params); $solr = new DealModel(); try { $solr_result = $solr->getDealsFromLocation($center, $radius, $query, $filters); echo json_encode($solr_result); } catch (Exception $e) { echo $e->getTraceAsString(); echo "unable to query deals from location"; } Yii::app()->end(); }
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; }
public static function getTopTerms($limit) { $criteria = new CDbCriteria(); $thisperiod = round(time() / (86400 * 30)); $thisperiod--; // find the last period one $condition = "`search` NOT LIKE '%*%' AND `search` NOT LIKE '%:%' AND `period` = {$thisperiod}"; $criteria->select = 'search'; $criteria->condition = $condition; $criteria->order = 'frequency DESC'; $num = $limit * 2; $criteria->limit = $num; $tops = static::model()->findAll($criteria); $returns = array(); $dealModel = new DealModel(); foreach ($tops as $t) { $exists = $dealModel->isTermExists($t->search); if ($exists && strlen($t->search) < 13) { $returns[] = $t->search; } } return array_slice($returns, 0, $limit); }