本文整理汇总了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;
}