當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Zend_Search_Lucene_Search_QueryParser::getDefaultEncoding方法代碼示例

本文整理匯總了PHP中Zend_Search_Lucene_Search_QueryParser::getDefaultEncoding方法的典型用法代碼示例。如果您正苦於以下問題:PHP Zend_Search_Lucene_Search_QueryParser::getDefaultEncoding方法的具體用法?PHP Zend_Search_Lucene_Search_QueryParser::getDefaultEncoding怎麽用?PHP Zend_Search_Lucene_Search_QueryParser::getDefaultEncoding使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Zend_Search_Lucene_Search_QueryParser的用法示例。


在下文中一共展示了Zend_Search_Lucene_Search_QueryParser::getDefaultEncoding方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: sfLuceneLowerCaseFilter

    $t->fail('::getConfig() returns the $config variable in the search.yml file');
}
$cswap->restore();
$t->diag('testing ->getCategoriesHarness()');
$cats = $lucene->getCategoriesHarness();
$t->isa_ok($cats, 'sfLuceneCategories', '->getCategories() returns an instance of sfLuceneCategories');
$t->ok($lucene->getCategoriesHarness() === $cats, '->getCategories() is a singleton');
$t->diag('testing ->getIndexerFactory()');
$indexer = $lucene->getIndexerFactory();
$t->isa_ok($indexer, 'sfLuceneIndexerFactory', '->getIndexer() returns an instance of sfLuceneIndexerFactory');
$t->diag('testing ->getContext()');
$t->isa_ok($lucene->getContext(), 'sfContext', '->getContext() returns an instance of sfContext');
$t->is($lucene->getContext(), sfContext::getInstance(), '->getContext() returns the same context');
$t->diag('testing ->configure()');
$lucene->configure();
$t->is(Zend_Search_Lucene_Search_QueryParser::getDefaultEncoding(), 'UTF-8', '->configure() configures the query parsers encoding');
foreach (array('Text', 'TextNum', 'Utf8', 'Utf8Num') as $type) {
    $lucene->setParameter('analyzer', $type);
    $lucene->configure();
    $class = 'Zend_Search_Lucene_Analysis_Analyzer_Common_' . $type;
    $expected = new $class();
    $expected->addFilter(new sfLuceneLowerCaseFilter(true));
    $expected->addFilter(new Zend_Search_Lucene_Analysis_TokenFilter_StopWords(array('and', 'the')));
    $expected->addFilter(new Zend_Search_Lucene_Analysis_TokenFilter_ShortWords(2));
    $actual = Zend_Search_Lucene_Analysis_Analyzer::getDefault();
    $t->ok($actual == $expected, '->configure() configures the analyzer for ' . $type);
}
$lucene->setParameter('analyzer', 'foobar');
try {
    $lucene->configure();
    $t->fail('->configure() analyzer must be of text, textnum, utf8, or utf8num');
開發者ID:palcoprincipal,項目名稱:sfLucenePlugin,代碼行數:31,代碼來源:sfLuceneTest.php


注:本文中的Zend_Search_Lucene_Search_QueryParser::getDefaultEncoding方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。