コード例 #1
0
$t->is($i['Analyzer'], 'Text', '->describe() has the correct analyzer');
class FooAnalyzer extends Zend_Search_Lucene_Analysis_Analyzer_Common_Text
{
}
$engine->setAnalyzer(new FooAnalyzer());
$i = $engine->describe();
$t->is($i['Analyzer'], 'FooAnalyzer', '->describe() does not crop an external analyzer class name');
$t->diag('->delete()');
$engine->commit();
$engine->delete('guid');
$engine->commit();
$t->is($engine->count(), 3, '->delete() removes a document');
$t->diag('->erase()');
$engine->add(new xfDocument('doc'));
$engine->commit();
$engine->erase();
$t->is($engine->count(), 0, '->erase() empties the index if it is open');
$t->isa_ok($engine->getIndex(), 'Zend_Search_Lucene_Proxy', '->erase() leaves the index open if it is open');
$engine->add(new xfDocument('doc'));
$engine->close();
$engine->erase();
try {
    $msg = '->erase() leaves the index close if it is closed';
    $engine->getIndex();
    $t->fail($msg);
} catch (Exception $e) {
    $t->pass($msg);
}
$engine->open();
$t->is($engine->count(), 0, '->erase() empties the index if it is closed');
$t->diag('->id()');