plug tag search
authorymh <ymh.work@gmail.com>
Wed, 14 Apr 2010 18:53:02 +0200
changeset 54 0851f98246af
parent 53 86c5f68fbaa8
child 55 34b333f92573
plug tag search
web/thdProject/apps/frontend/modules/search/actions/viewSearchListAction.class.php
web/thdProject/apps/frontend/modules/tag/actions/viewTagListAction.class.php
web/thdProject/config/ProjectConfiguration.class.php
--- a/web/thdProject/apps/frontend/modules/search/actions/viewSearchListAction.class.php	Wed Apr 14 18:21:01 2010 +0200
+++ b/web/thdProject/apps/frontend/modules/search/actions/viewSearchListAction.class.php	Wed Apr 14 18:53:02 2010 +0200
@@ -13,14 +13,6 @@
     $this->indexNbItems = 2;
     $this->videoPath = sfConfig::get('app_player_videoPath');
     
-    /*$query = Doctrine_Query::create()
-      ->from('ThdFilm F')
-      ->leftJoin('F.images I ')
-      ->leftJoin('F.videos V')
-      //->where("cu.code='{$culture}' AND mo.code='{$module}' AND ms.code='{$section}'")
-      ->orderBy('F.id DESC')
-      ->limit(0,10);*/
-
     $solr = uvmcSolrServicesManager::getInstance()->getService();
     $response = $solr->search($this->text, $this->pageIndex * $this->pageNbItems, $this->pageNbItems);
 
--- a/web/thdProject/apps/frontend/modules/tag/actions/viewTagListAction.class.php	Wed Apr 14 18:21:01 2010 +0200
+++ b/web/thdProject/apps/frontend/modules/tag/actions/viewTagListAction.class.php	Wed Apr 14 18:53:02 2010 +0200
@@ -3,6 +3,7 @@
 class viewTagListAction extends sfAction {
 
   public function execute($request) {
+  	
   	// Parse request parameters
     $format = $request->getRequestFormat();
     $this->tag = (string) $request->getParameter('tag');   
@@ -12,6 +13,26 @@
     $this->indexNbItems = 2;
 
     
+    $solr = uvmcSolrServicesManager::getInstance()->getService();
+    $response = $solr->search("tags:".$this->tag, $this->pageIndex * $this->pageNbItems, $this->pageNbItems);
+
+    $results = unserialize($response->getRawResponse());              
+
+    $primaryKeys = array();
+    foreach($results['response']['docs'] as $doc)
+    {
+      $primaryKeys[] = $doc['id'];
+    }
+
+    if(!empty($primaryKeys))
+    {
+      $this->mostTaggedFilms = Doctrine::getTable('ThdFilm')->findByScoredId($primaryKeys);       
+    }
+    else
+    {
+      $this->mostTaggedFilms = array();
+    }
+    
     return sfView::SUCCESS;
   }
 }
\ No newline at end of file
--- a/web/thdProject/config/ProjectConfiguration.class.php	Wed Apr 14 18:21:01 2010 +0200
+++ b/web/thdProject/config/ProjectConfiguration.class.php	Wed Apr 14 18:53:02 2010 +0200
@@ -1,13 +1,20 @@
 <?php
-require_once '/opt/symfony/1.2.9/lib/autoload/sfCoreAutoload.class.php';
+// Virtualbox dev
+//require_once '/opt/symfony-1.2.8/lib/autoload/sfCoreAutoload.class.php';
+// Gothbook dev
+putenv("PATH=/opt/local/bin:/usr/bin:/bin:/usr/sbin:/sbin");
 
+
+
+define('SF_ENVIRONMENT', 'dev');
+require_once dirname(__FILE__).'/../lib/vendor/symfony/lib/autoload/sfCoreAutoload.class.php';
 sfCoreAutoload::register();
 
 class ProjectConfiguration extends sfProjectConfiguration
 {
   public function setup()
 	{
-	  	$this->enableAllPluginsExcept(array('sfPropelPlugin', 'sfCompat10Plugin', 'iriSonyenginePlugin', 'uvmcSolrSearchPlugin'));
+	  	$this->enableAllPluginsExcept(array('sfPropelPlugin', 'sfCompat10Plugin'));
 	}
 
   public function configureDoctrineConnection(Doctrine_Connection $conn) {