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); }
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']); } }