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


PHP Zend_Search_Lucene::setTermsPerQueryLimit方法代码示例

本文整理汇总了PHP中Zend_Search_Lucene::setTermsPerQueryLimit方法的典型用法代码示例。如果您正苦于以下问题:PHP Zend_Search_Lucene::setTermsPerQueryLimit方法的具体用法?PHP Zend_Search_Lucene::setTermsPerQueryLimit怎么用?PHP Zend_Search_Lucene::setTermsPerQueryLimit使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Zend_Search_Lucene的用法示例。


在下文中一共展示了Zend_Search_Lucene::setTermsPerQueryLimit方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: getIndex

 /**
  * @return Search_Index_Interface
  */
 function getIndex($indexType = 'data')
 {
     global $prefs, $tiki_p_admin;
     $writeMode = false;
     if ($indexType == 'data-write') {
         $indexType = 'data';
         $writeMode = true;
     }
     switch ($prefs['unified_engine']) {
         case 'lucene':
             Zend_Search_Lucene::setTermsPerQueryLimit($prefs['unified_lucene_terms_limit']);
             $index = new Search_Lucene_Index($this->getIndexLocation($indexType), $prefs['language'], $prefs['unified_lucene_highlight'] == 'y');
             $index->setCache(TikiLib::lib('cache'));
             $index->setMaxResults($prefs['unified_lucene_max_result']);
             $index->setResultSetLimit($prefs['unified_lucene_max_resultset_limit']);
             return $index;
         case 'elastic':
             $index = $this->getIndexLocation($indexType);
             if (empty($index)) {
                 break;
             }
             $connection = $this->getElasticConnection($writeMode);
             $index = new Search_Elastic_Index($connection, $index);
             $index->setCamelCaseEnabled($prefs['unified_elastic_camel_case'] == 'y');
             $index->setFacetCount($prefs['search_facet_default_amount']);
             return $index;
         case 'mysql':
             $index = $this->getIndexLocation($indexType);
             if (empty($index)) {
                 break;
             }
             $index = new Search_MySql_Index(TikiDb::get(), $index);
             return $index;
     }
     // Do nothing, provide a fake index.
     $errlib = TikiLib::lib('errorreport');
     if ($tiki_p_admin != 'y') {
         $errlib->report(tr('Contact the site administrator. The index needs rebuilding.'));
     } else {
         $errlib->report('<a title="' . tr("Rebuild Search index") . '" href="tiki-admin.php?page=search&rebuild=now">' . tr("Click here to rebuild index") . '</a>');
     }
     return new Search_Index_Memory();
 }
开发者ID:ameoba32,项目名称:tiki,代码行数:46,代码来源:searchlib-unified.php

示例2: getIndex

 /**
  * @return Search_Index_Lucene
  */
 function getIndex()
 {
     global $prefs;
     switch ($prefs['unified_engine']) {
         case 'lucene':
             Zend_Search_Lucene::setTermsPerQueryLimit($prefs['unified_lucene_terms_limit']);
             $index = new Search_Index_Lucene($this->getIndexLocation(), $prefs['language'], $prefs['unified_lucene_highlight'] == 'y');
             $index->setCache(TikiLib::lib('cache'));
             $index->setMaxResults($prefs['unified_lucene_max_result']);
             $index->setResultSetLimit($prefs['unified_lucene_max_resultset_limit']);
             return $index;
         case 'elastic':
             if (empty($prefs['unified_elastic_index_current'])) {
                 return null;
             }
             $connection = $this->getElasticConnection();
             $index = new Search_Elastic_Index($connection, $prefs['unified_elastic_index_current']);
             return $index;
     }
 }
开发者ID:hurcane,项目名称:tiki-azure,代码行数:23,代码来源:searchlib-unified.php

示例3: _index

 /**
  * Instanciate the Lucene index
  * 
  * The index will be created if it doesn't exist yet.
  * 
  * @return \Zend_Search_Lucene_Interface							Lucene index instance
  * @throws Exception											If the index cannot be created
  */
 protected function _index()
 {
     // One-time instanciation or creation of the lucene index
     if ($this->_index === null) {
         // Try to instanciate an existing lucene index
         try {
             $this->_index = \Zend_Search_Lucene::open($this->_indexDirectory);
             // If an error occurs ...
         } catch (\Zend_Search_Lucene_Exception $e) {
             // Try to create a new lucene index ...
             try {
                 $this->_index = \Zend_Search_Lucene::create($this->_indexDirectory);
                 // If an error occurs: Failure
             } catch (\Zend_Search_Lucene_Exception $e) {
                 throw new Exception(sprintf('Error creating lucene index in "%1$s", reason: "%2$s"', $this->_indexDirectory, $e->getMessage()));
             }
         }
         // Index setup
         \Zend_Search_Lucene_Storage_Directory_Filesystem::setDefaultFilePermissions(0664);
         \Zend_Search_Lucene_Analysis_Analyzer::setDefault(new \Zend_Search_Lucene_Analysis_Analyzer_Common_Utf8Num_CaseInsensitive());
         \Zend_Search_Lucene_Search_QueryParser::setDefaultEncoding('UTF-8');
         // Minimize memory consumption
         $this->_index->setMaxBufferedDocs(1);
         // Set optimization frequency
         $this->_index->setMergeFactor(max(1, intval($GLOBALS['TYPO3_CONF_VARS']['EXT']['extParams']['tw_lucenesearch']['mergeFactor'])));
         // If applicable: Optimize index
         if ($this->_indexOptimize) {
             $this->_index->optimize();
         }
         $this->_index->commit();
         if (TYPO3_MODE == 'FE') {
             \Zend_Search_Lucene::setTermsPerQueryLimit(\Tollwerk\TwLucenesearch\Utility\Indexer::indexConfig($GLOBALS['TSFE'], 'search.limits.query'));
         }
     }
     return $this->_index;
 }
开发者ID:GerDner,项目名称:TYPO3-ext-tw_lucenesearch,代码行数:44,代码来源:Lucene.php

示例4: open_index

 /**
  *
  * @throws nc_search_exception
  */
 protected function open_index()
 {
     $path = $this->get_index_path();
     try {
         if ($this->index_exists($path)) {
             $this->index = Zend_Search_Lucene::open($path);
         } else {
             $this->index = Zend_Search_Lucene::create($path);
         }
     } catch (Zend_Search_Lucene_Exception $e) {
         throw new nc_search_exception("Cannot open Lucene index: {$e->getMessage()}");
     }
     $this->is_opened = true;
     // apply settings to the index
     Zend_Search_Lucene::setResultSetLimit($this->get_setting('ZendSearchLucene_ResultSetLimit'));
     Zend_Search_Lucene::setTermsPerQueryLimit($this->get_setting('MaxTermsPerQuery'));
     $settings = array('MaxBufferedDocs', 'MaxMergeDocs', 'MergeFactor');
     foreach ($settings as $s) {
         $setter = "set{$s}";
         $this->index->{$setter}($this->get_setting("ZendSearchLucene_{$s}"));
     }
     // set analyzer
     Zend_Search_Lucene_Analysis_Analyzer::setDefault(new nc_search_provider_zend_analyzer());
     // set fuzzy prefix length so fuzzy searches will match a wider array of possibilities
     Zend_Search_Lucene_Search_Query_Fuzzy::setDefaultPrefixLength(0);
     // set wildcard prefix length so wildcards will match a wider array of possibilities
     Zend_Search_Lucene_Search_Query_Wildcard::setMinPrefixLength(0);
     /**
      * @todo set default search fields
      */
 }
开发者ID:Blu2z,项目名称:implsk,代码行数:35,代码来源:zend.php

示例5: getIndex

 function getIndex()
 {
     global $prefs;
     if ($prefs['unified_engine'] == 'lucene') {
         Zend_Search_Lucene::setTermsPerQueryLimit($prefs['unified_lucene_terms_limit']);
         $index = new Search_Index_Lucene($this->getIndexLocation(), $prefs['language'], $prefs['unified_lucene_highlight'] == 'y');
         $index->setCache(TikiLib::lib('cache'));
         $index->setMaxResults($prefs['unified_lucene_max_result']);
         $index->setResultSetLimit($prefs['unified_lucene_max_resultset_limit']);
         return $index;
     }
 }
开发者ID:railfuture,项目名称:tiki-website,代码行数:12,代码来源:searchlib-unified.php


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