本文整理匯總了PHP中Zend_Search_Lucene_Search_Query_Fuzzy::getDefaultPrefixLength方法的典型用法代碼示例。如果您正苦於以下問題:PHP Zend_Search_Lucene_Search_Query_Fuzzy::getDefaultPrefixLength方法的具體用法?PHP Zend_Search_Lucene_Search_Query_Fuzzy::getDefaultPrefixLength怎麽用?PHP Zend_Search_Lucene_Search_Query_Fuzzy::getDefaultPrefixLength使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Zend_Search_Lucene_Search_Query_Fuzzy
的用法示例。
在下文中一共展示了Zend_Search_Lucene_Search_Query_Fuzzy::getDefaultPrefixLength方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: setUp
public function setUp()
{
require_once 'Zend/Search/Lucene/Search/Query/Wildcard.php';
$this->_wildcardMinPrefix = Zend_Search_Lucene_Search_Query_Wildcard::getMinPrefixLength();
Zend_Search_Lucene_Search_Query_Wildcard::setMinPrefixLength(0);
require_once 'Zend/Search/Lucene/Search/Query/Fuzzy.php';
$this->_defaultPrefixLength = Zend_Search_Lucene_Search_Query_Fuzzy::getDefaultPrefixLength();
Zend_Search_Lucene_Search_Query_Fuzzy::setDefaultPrefixLength(0);
}
示例2: testFuzzyQuery
public function testFuzzyQuery()
{
$index = Zend_Search_Lucene::open(dirname(__FILE__) . '/_index23Sample/_files');
$defaultPrefixLength = Zend_Search_Lucene_Search_Query_Fuzzy::getDefaultPrefixLength();
Zend_Search_Lucene_Search_Query_Fuzzy::setDefaultPrefixLength(0);
$hits = $index->find('tesd~0.4');
$this->assertEquals(count($hits), 9);
$expectedResultset = array(array(2, 0.037139, 'IndexSource/contributing.patches.html'), array(0, 0.008735, 'IndexSource/contributing.documentation.html'), array(7, 0.002449, 'IndexSource/contributing.bugs.html'), array(1, 0.000483, 'IndexSource/contributing.wishlist.html'), array(3, 0.000483, 'IndexSource/about-pear.html'), array(9, 0.000483, 'IndexSource/core.html'), array(5, 0.000414, 'IndexSource/authors.html'), array(8, 0.000414, 'IndexSource/contributing.html'), array(4, 0.000345, 'IndexSource/copyright.html'));
foreach ($hits as $resId => $hit) {
$this->assertEquals($hit->id, $expectedResultset[$resId][0]);
$this->assertTrue(abs($hit->score - $expectedResultset[$resId][1]) < 1.0E-6);
$this->assertEquals($hit->path, $expectedResultset[$resId][2]);
}
Zend_Search_Lucene_Search_Query_Fuzzy::setDefaultPrefixLength($defaultPrefixLength);
}