# HG changeset patch # User ymh # Date 1271262032 -7200 # Node ID cd141ba2fad8a001b02dbbfad69cadf250a69169 # Parent ec1fec8293ab5991e566eac072ac145b2eba57a7 plug solr search diff -r ec1fec8293ab -r cd141ba2fad8 engine/solr/solr/conf/schema.xml --- a/engine/solr/solr/conf/schema.xml Wed Apr 14 18:13:17 2010 +0200 +++ b/engine/solr/solr/conf/schema.xml Wed Apr 14 18:20:32 2010 +0200 @@ -95,7 +95,7 @@ - + diff -r ec1fec8293ab -r cd141ba2fad8 web/thdProject/apps/backend/modules/film/actions/actions.class.php --- a/web/thdProject/apps/backend/modules/film/actions/actions.class.php Wed Apr 14 18:13:17 2010 +0200 +++ b/web/thdProject/apps/backend/modules/film/actions/actions.class.php Wed Apr 14 18:20:32 2010 +0200 @@ -23,7 +23,7 @@ // reset sony engine $dispatcher = sfContext::getInstance()->getEventDispatcher(); - $dispatcher->notify(new sfEvent("", 'iri_sonyengine.reset', array('retrain' => true))); + $dispatcher->notify(new sfEvent($this, 'iri_sonyengine.reset', array('retrain' => true))); $films_array = array(); diff -r ec1fec8293ab -r cd141ba2fad8 web/thdProject/apps/frontend/modules/search/actions/viewSearchListAction.class.php --- a/web/thdProject/apps/frontend/modules/search/actions/viewSearchListAction.class.php Wed Apr 14 18:13:17 2010 +0200 +++ b/web/thdProject/apps/frontend/modules/search/actions/viewSearchListAction.class.php Wed Apr 14 18:20:32 2010 +0200 @@ -13,15 +13,33 @@ $this->indexNbItems = 2; $this->videoPath = sfConfig::get('app_player_videoPath'); - $query = Doctrine_Query::create() + /*$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); - $this->searchFilms = $query->execute(); - + ->limit(0,10);*/ + + $solr = uvmcSolrServicesManager::getInstance()->getService(); + $response = $solr->search($this->text, $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->searchFilms = Doctrine::getTable('ThdFilm')->findByScoredId($primaryKeys); + } + else + { + $this->searchFilms = array(); + } return sfView::SUCCESS; }