当前位置: 首页>>代码示例>>PHP>>正文


PHP Zend_Search_Lucene_Field::Unindexed方法代码示例

本文整理汇总了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;
	}
开发者ID:rii-J,项目名称:concrete5-de,代码行数:61,代码来源:indexed_search.php


注:本文中的Zend_Search_Lucene_Field::Unindexed方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。