本文整理匯總了PHP中Zend_Search_Lucene_Field::Unindexed方法的典型用法代碼示例。如果您正苦於以下問題:PHP Zend_Search_Lucene_Field::Unindexed方法的具體用法?PHP Zend_Search_Lucene_Field::Unindexed怎麽用?PHP Zend_Search_Lucene_Field::Unindexed使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Zend_Search_Lucene_Field
的用法示例。
在下文中一共展示了Zend_Search_Lucene_Field::Unindexed方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: reindex
/**
* Reindexes the search engine.
*/
public function reindex() {
Loader::library('3rdparty/Zend/Search/Lucene');
Loader::library('3rdparty/StandardAnalyzer/Analyzer/Standard/English');
$index = new Zend_Search_Lucene(DIR_FILES_CACHE_PAGES, true);
//Zend_Search_Lucene_Analysis_Analyzer::setDefault(new Zend_Search_Lucene_Analysis_Analyzer_Common_Utf8Num_CaseInsensitive());
Zend_Search_Lucene_Analysis_Analyzer::setDefault(new StandardAnalyzer_Analyzer_Standard_English());
$db = Loader::db();
$collection_attributes = Loader::model('collection_attributes');
$r = $db->query("select cID from Pages order by cID asc");
$g = Group::getByID(GUEST_GROUP_ID);
$nh = Loader::helper('navigation');
while ($row = $r->fetchRow()) {
$c = Page::getByID($row['cID'], 'ACTIVE');
if($c->getCollectionAttributeValue('exclude_search_index')) continue;
$themeObject = $c->getCollectionThemeObject();
$g->setPermissionsForObject($c);
if ($g->canRead()) {
$pageID = md5($row['cID']);
$doc = new Zend_Search_Lucene_Document();
$doc->addField(Zend_Search_Lucene_Field::Keyword('cIDhash', $pageID));
$doc->addField(Zend_Search_Lucene_Field::Unindexed('cID', $row['cID']));
$doc->addField(Zend_Search_Lucene_Field::Text('cName', $c->getCollectionName(), APP_CHARSET));
$doc->addField(Zend_Search_Lucene_Field::Keyword('ctHandle', $c->getCollectionTypeHandle()));
$doc->addField(Zend_Search_Lucene_Field::Text('cDescription', $c->getCollectionDescription(), APP_CHARSET));
$doc->addField(Zend_Search_Lucene_Field::Text('cBody', $this->getBodyContentFromPage($c), APP_CHARSET));
if (is_object($themeObject)) {
$doc->addField(Zend_Search_Lucene_Field::Text('cTheme', $themeObject->getThemeHandle()));
}
$doc->addField(Zend_Search_Lucene_Field::Text( 'cPath', $c->getCollectionPath()));
if (count($this->cPathSections) > 0) {
foreach($this->cPathSections as $var => $cPath) {
$isInSection = (strstr(strtolower($c->getCollectionPath()), $cPath . '/')) ? 'true' : 'false';
$doc->addField(Zend_Search_Lucene_Field::Keyword($var, $isInSection));
}
}
$attributes=$c->getSetCollectionAttributes();
foreach($attributes as $attribute){
if ($attribute->isCollectionAttributeKeySearchable()) {
$doc->addField(Zend_Search_Lucene_Field::Keyword( $attribute->akHandle, $c->getCollectionAttributeValue($attribute) ));
}
}
$index->addDocument($doc);
}
}
$result = new stdClass;
$result->count = $index->count();
return $result;
}