--- a/engine/solr/solr/conf/schema.xml Wed Apr 14 16:20:20 2010 +0200
+++ b/engine/solr/solr/conf/schema.xml Wed Apr 14 17:39:11 2010 +0200
@@ -50,7 +50,7 @@
</fieldType>
<fieldType name="tags" class="solr.TextField" sortMissingLast="true" omitNorms="true" >
<analyzer>
- <tokenizer class="solr.PatternTokenizerFactory" pattern="; *" />
+ <tokenizer class="solr.PatternTokenizerFactory" pattern=",*" />
<filter class="solr.LowerCaseFilterFactory"/>
<filter class="solr.TrimFilterFactory" />
<filter class="solr.SnowballPorterFilterFactory" language="French" />
Binary file engine/sonyengine/mosatags.sonyengine.war has changed
--- a/web/thdProject/lib/model/doctrine/ThdSegment.class.php Wed Apr 14 16:20:20 2010 +0200
+++ b/web/thdProject/lib/model/doctrine/ThdSegment.class.php Wed Apr 14 17:39:11 2010 +0200
@@ -6,7 +6,7 @@
class ThdSegment extends BaseThdSegment
{
- public function getSolrDocumentFields()
+ /*public function getSolrDocumentFields()
{ // keys of this array are fields' name of solr's schema.xml
$type = "ThdFilm";
$fields = array('type' => $type,
@@ -18,12 +18,52 @@
);
return $fields;
- }
+ }*/
public function preInsert($event)
{
$this->uniqueid = UUID::generate(UUID::UUID_TIME, UUID::FMT_STRING, "mosatags");
}
+
+ 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)));
+
+
+ }
}