Exemplo n.º 1
0
 private function buildExpr(array $objectList)
 {
     $query = new Search_Query();
     foreach ($objectList as $object) {
         $object = (array) $object;
         $query->addObject($object['object_type'], $object['object_id']);
     }
     return $query->getExpr();
 }
 function testReplaceDocument()
 {
     $query = new Search_Query();
     $query->addObject('wiki page', 'SomePage');
     $index = new Search_Index_Lucene($this->dir);
     $query->invalidate($index);
     $this->addDocument($index, 'wiki page', 'SomePage', 'Foobar');
     $this->assertResultFound('foobar', $index);
     $this->assertResultFound('content', $index, 0);
 }
Exemplo n.º 3
0
function smarty_block_ifsearchnotexists($params, $content, $smarty, &$repeat)
{
    if (empty($params['type']) || empty($params['id'])) {
        return '';
    }
    TikiLib::lib('access')->check_feature('feature_search');
    $query = new Search_Query();
    $query->addObject($params['type'], $params['id']);
    $index = TikiLib::lib('unifiedsearch')->getIndex();
    $result = $query->search($index);
    if ($result->count() > 0) {
        return '';
    } else {
        return $content;
    }
}
Exemplo n.º 4
0
 function update($searchArgument)
 {
     if (is_array($searchArgument)) {
         $query = new Search_Query();
         foreach ($searchArgument as $object) {
             $obj2array = (array) $object;
             $query->addObject($obj2array['object_type'], $obj2array['object_id']);
         }
         $result = $query->invalidate($this->searchIndex);
         $objectList = $searchArgument;
     } elseif ($searchArgument instanceof Search_Query) {
         $objectList = $searchArgument->invalidate($this->searchIndex);
     }
     foreach ($objectList as $object) {
         $obj2array = (array) $object;
         $this->addDocument($obj2array['object_type'], $obj2array['object_id']);
     }
 }
Exemplo n.º 5
0
 function testSearchObject()
 {
     $query = new Search_Query();
     $query->addObject('wikipage?!', 'Comité Wiki');
     $this->assertGreaterThan(0, count($query->search($this->index)));
 }