# HG changeset patch # User ymh # Date 1272503112 -7200 # Node ID 17b95f521b017ae3163afa743e3f165a956657a4 # Parent 4227dc4dd211468ea873b2aecae6bf23264c0dbd add facet to tags, correct auto indexation diff -r 4227dc4dd211 -r 17b95f521b01 engine/solr/solr/conf/schema.xml --- a/engine/solr/solr/conf/schema.xml Wed Apr 28 20:08:07 2010 +0200 +++ b/engine/solr/solr/conf/schema.xml Thu Apr 29 03:05:12 2010 +0200 @@ -52,7 +52,7 @@ - + @@ -94,7 +94,7 @@ - + diff -r 4227dc4dd211 -r 17b95f521b01 engine/sonyengine/mosatags.sonyengine.war Binary file engine/sonyengine/mosatags.sonyengine.war has changed diff -r 4227dc4dd211 -r 17b95f521b01 web/thdProject/lib/model/doctrine/ThdFilm.class.php --- a/web/thdProject/lib/model/doctrine/ThdFilm.class.php Wed Apr 28 20:08:07 2010 +0200 +++ b/web/thdProject/lib/model/doctrine/ThdFilm.class.php Thu Apr 29 03:05:12 2010 +0200 @@ -26,7 +26,7 @@ $directors = $this->getSolrTextValue($this->getDirectors()); $actors = $this->getSolrTextValue($this->getActors()); $original_title = $this->getSolrTextValue($this->getOriginal_title()); - $tags = $this->getSolrTextValue($this->getTagsToText()); + $tags = $this->getTags(); //$all = implode(" ",array($title,$desc,$directors,$actors,$original_title,$tags)); $fields = array('type' => $this->getSolrTextValue($type), diff -r 4227dc4dd211 -r 17b95f521b01 web/thdProject/lib/model/doctrine/ThdSegment.class.php --- a/web/thdProject/lib/model/doctrine/ThdSegment.class.php Wed Apr 28 20:08:07 2010 +0200 +++ b/web/thdProject/lib/model/doctrine/ThdSegment.class.php Thu Apr 29 03:05:12 2010 +0200 @@ -48,61 +48,4 @@ return $tags; } - /*public function getSolrDocumentFields() - { // keys of this array are fields' name of solr's schema.xml - $type = "ThdFilm"; - $fields = array('type' => $type, - 'id' => $this->getId(), - 'title' => array('value' => $this->getTitle(), 'boost' => 1.0), - 'tags' => array('value' => $this->getTags(), 'boost' => 1.0), - 'desc' => array('value' => $this->getDesc(), 'boost' => 1.0), - 'uniqueid' => array('value' => $this->getUniqueid(), 'boost' => 1.0), - ); - - return $fields; - }*/ - - - -/* - public function getTagsArray() { - - $tags = $this->getTags(); - $res = array(); - - foreach (explode(',',$tags) as $tag_name) { - $res[] = trim($tag_name); - } - - return $res; - } - - - public function postInsert($event) { - - $q = Doctrine_Query::create() - ->from('ThdSegment s') - ->innerJoin('s.ThdVideo v') - ->innerJoin('v.ThdFilm f') - ->where('s.id = ?', $this->id); - - $segment = $q->fetchOne(); - - $tags_array = array(); - - $tags = $this->getTagsArray(); - foreach ($tags as $tag_name) { - $tags_array[] = array('segment_id'=>$segment->ThdVideo->ThdFilm->uniqueid,'name'=>$tag_name); - } - - sfContext::getInstance()->getLogger()->info("insert segment " . print_r($tags_array,true)); - - $dispatcher = sfContext::getInstance()->getEventDispatcher(); - $dispatcher->notify(new sfEvent($this, 'iri_sonyengine.tag_add', array('object'=>$tags_array, 'retrain'=>true))); - - $dispatcher->notify(new sfEvent($this, 'uvmc_solr.update_document', array('object' => $segment->ThdVideo->ThdFilm, 'commit' => true))); - - - }*/ - } diff -r 4227dc4dd211 -r 17b95f521b01 web/thdProject/lib/model/doctrine/ThdTagTable.class.php --- a/web/thdProject/lib/model/doctrine/ThdTagTable.class.php Wed Apr 28 20:08:07 2010 +0200 +++ b/web/thdProject/lib/model/doctrine/ThdTagTable.class.php Thu Apr 29 03:05:12 2010 +0200 @@ -4,5 +4,5 @@ */ class ThdTagTable extends Doctrine_Table { - +//http://localhost:8080/solr/select?q=*%3A*&rows=0&facet=true&facet.limit=-1&facet.field=tags } \ No newline at end of file diff -r 4227dc4dd211 -r 17b95f521b01 web/thdProject/lib/model/doctrine/ThdVideo.class.php --- a/web/thdProject/lib/model/doctrine/ThdVideo.class.php Wed Apr 28 20:08:07 2010 +0200 +++ b/web/thdProject/lib/model/doctrine/ThdVideo.class.php Thu Apr 29 03:05:12 2010 +0200 @@ -22,6 +22,24 @@ $segmentTagObj->setTagId($tagObj->getId()); $segmentTagObj->save(); } + + $q = Doctrine_Query::create() + ->from('ThdVideo v') + ->innerJoin('v.ThdFilm f') + ->where('v.id = ?', $this->id); + + $segment = $q->fetchOne(); + + foreach ($tags as $tag_name) { + $tags_array[] = array('segment_id'=>$this->ThdFilm->uniqueid,'name'=>$tag_name); + } + + sfContext::getInstance()->getLogger()->info("insert segment " . print_r($tags_array,true)); + + $dispatcher = sfContext::getInstance()->getEventDispatcher(); + $dispatcher->notify(new sfEvent($this, 'iri_sonyengine.tag_add', array('object'=>$tags_array, 'retrain'=>true))); + + $dispatcher->notify(new sfEvent($this, 'uvmc_solr.update_document', array('object' => $this->ThdFilm, 'commit' => true))); return $segmentObj; } diff -r 4227dc4dd211 -r 17b95f521b01 web/thdProject/plugins/uvmcSolrSearchPlugin/lib/uvmcSolrEventListener.class.php --- a/web/thdProject/plugins/uvmcSolrSearchPlugin/lib/uvmcSolrEventListener.class.php Wed Apr 28 20:08:07 2010 +0200 +++ b/web/thdProject/plugins/uvmcSolrSearchPlugin/lib/uvmcSolrEventListener.class.php Thu Apr 29 03:05:12 2010 +0200 @@ -195,7 +195,18 @@ if (isset($fieldProperty['value'])) { $boost = isset($fieldProperty['boost']) ? (float) $fieldProperty['boost'] : false; - $document->addField($fieldName, $fieldProperty['value'], $boost); + $value = $fieldProperty['value']; + if (is_array($value)) + { + foreach($value as $multivalue) + { + $document->addField($fieldName, $multivalue, $boost); + } + } + else + { + $document->addField($fieldName, $value, $boost); + } } else {