Пример #1
0
     }
     break;
 case 'full_text_search_enlarge':
     $sFullText = trim(utils::ReadParam('text', '', false, 'raw_data'));
     $sClass = trim(utils::ReadParam('class', ''));
     $iTune = utils::ReadParam('tune', 0);
     if (preg_match('/^"(.*)"$/', $sFullText, $aMatches)) {
         // The text is surrounded by double-quotes, remove the quotes and treat it as one single expression
         $aFullTextNeedles = array($aMatches[1]);
     } else {
         // Split the text on the blanks and treat this as a search for <word1> AND <word2> AND <word3>
         $aFullTextNeedles = explode(' ', $sFullText);
     }
     $oFilter = new DBObjectSearch($sClass);
     foreach ($aFullTextNeedles as $sSearchText) {
         $oFilter->AddCondition_FullText($sSearchText);
     }
     $oSet = new DBObjectSet($oFilter);
     $oPage->add("<div class=\"page_header\">\n");
     $oPage->add("<h2>" . MetaModel::GetClassIcon($sClass) . "&nbsp;<span class=\"hilite\">" . Dict::Format('UI:Search:Count_ObjectsOf_Class_Found', $oSet->Count(), Metamodel::GetName($sClass)) . "</h2>\n");
     $oPage->add("</div>\n");
     if ($oSet->Count() > 0) {
         $aLeafs = array();
         while ($oObj = $oSet->Fetch()) {
             if (get_class($oObj) == $sClass) {
                 $aLeafs[] = $oObj->GetKey();
             }
         }
         $oLeafsFilter = new DBObjectSearch($sClass);
         if (count($aLeafs) > 0) {
             $oLeafsFilter->AddCondition('id', $aLeafs, 'IN');
Пример #2
0
 protected function DoExecute()
 {
     echo "<h3>Create protagonists...</h3>";
     $iId1 = $this->InsertMammal('human', 'male', 10, 0, 0, 'romanoff', 192, '1971-07-19');
     $iId2 = $this->InsertMammal('human', 'female', 9, 0, 0, 'rouanita', 165, '1983-01-23');
     $this->InsertMammal('human', 'female', 3, $iId2, $iId1, 'pomme', 169, '2008-02-23');
     $this->InsertMammal('pig', 'female', 3, 0, 0, 'grouinkette', 85, '2006-06-01');
     $this->InsertMammal('donkey', 'female', 3, 0, 0, 'muleta', 124, '2003-11-11');
     $this->InsertBird('rooster', 'male', 12, 0, 0);
     $this->InsertFlyingBird('pie', 'female', 11, 0, 0, 35);
     echo "<h3>Search...</h3>";
     $oSearch = new DBObjectSearch('Mammal');
     $oSearch->AddCondition_FullText('manof');
     //$oResultSet = new DBObjectSet($oSearch);
     $this->search_and_show_list($oSearch);
 }