예제 #1
0
 public static function getotherNameI18nsById($id, array $options = array())
 {
     $criteria = new Criteria();
     self::addotherNameI18nsCriteriaById($criteria, $id);
     return QubitOtherNameI18n::get($criteria, $options);
 }
 public static function addActorIndex(QubitActor $actor)
 {
     // Don't index root object
     if ($actor::ROOT_ID == $actor->id) {
         return;
     }
     foreach ($actor->actorI18ns as $actorI18n) {
         $doc = new Zend_Search_Lucene_Document();
         $doc->addField(Zend_Search_Lucene_Field::Keyword('id', $actor->id));
         $doc->addField(Zend_Search_Lucene_Field::Keyword('className', $actor->className));
         $doc->addField(Zend_Search_Lucene_Field::Keyword('culture', $actorI18n->culture));
         if (isset($actorI18n->authorizedFormOfName)) {
             $doc->addField(Zend_Search_Lucene_Field::UnStored('authorizedFormOfName', $actorI18n->authorizedFormOfName));
         }
         // Add other forms of name for this culture
         $criteria = new Criteria();
         $criteria->addJoin(QubitOtherNameI18n::ID, QubitOtherName::ID);
         $criteria->add(QubitOtherNameI18n::CULTURE, $actorI18n->culture);
         $criteria->add(QubitOtherName::OBJECT_ID, $actor->id);
         if (0 < count($otherNameI18ns = QubitOtherNameI18n::get($criteria))) {
             foreach ($otherNameI18ns as $otherNameI18n) {
                 $otherNames[] = $otherNameI18n->name;
             }
             $doc->addField(Zend_Search_Lucene_Field::UnStored('otherFormsOfName', implode(' ', $otherNames)));
         }
         self::getInstance()->getEngine()->getIndex()->addDocument($doc);
     }
 }