當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Zend_Search_Lucene_Search_QueryParser::setDefaultEncoding方法代碼示例

本文整理匯總了PHP中Zend_Search_Lucene_Search_QueryParser::setDefaultEncoding方法的典型用法代碼示例。如果您正苦於以下問題:PHP Zend_Search_Lucene_Search_QueryParser::setDefaultEncoding方法的具體用法?PHP Zend_Search_Lucene_Search_QueryParser::setDefaultEncoding怎麽用?PHP Zend_Search_Lucene_Search_QueryParser::setDefaultEncoding使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Zend_Search_Lucene_Search_QueryParser的用法示例。


在下文中一共展示了Zend_Search_Lucene_Search_QueryParser::setDefaultEncoding方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: getInstance

 /**
  * Returns Zend_Search_Lucene instance for given subroot
  *
  * every subroot has it's own instance
  *
  * @param Kwf_Component_Data for this index
  * @return Zend_Search_Lucene_Interface
  */
 public static function getInstance(Kwf_Component_Data $subroot)
 {
     while ($subroot) {
         if (Kwc_Abstract::getFlag($subroot->componentClass, 'subroot')) {
             break;
         }
         $subroot = $subroot->parent;
     }
     if (!$subroot) {
         $subroot = Kwf_Component_Data_Root::getInstance();
     }
     static $instance = array();
     if (!isset($instance[$subroot->componentId])) {
         $analyzer = new Zend_Search_Lucene_Analysis_Analyzer_Common_Utf8Num_CaseInsensitive();
         $analyzer->addFilter(new Zend_Search_Lucene_Analysis_TokenFilter_ShortWords(2));
         //$stopWords = explode(' ', 'der dir das einer eine ein und oder doch ist sind an in vor nicht wir ihr sie es ich');
         //$analyzer->addFilter(new Zend_Search_Lucene_Analysis_TokenFilter_StopWords($stopWords));
         Zend_Search_Lucene_Analysis_Analyzer::setDefault($analyzer);
         Zend_Search_Lucene_Search_QueryParser::setDefaultEncoding('utf-8');
         Zend_Search_Lucene_Storage_Directory_Filesystem::setDefaultFilePermissions(0666);
         $path = 'cache/fulltext';
         $path .= '/' . $subroot->componentId;
         try {
             $instance[$subroot->componentId] = Zend_Search_Lucene::open($path);
         } catch (Zend_Search_Lucene_Exception $e) {
             $instance[$subroot->componentId] = Zend_Search_Lucene::create($path);
         }
     }
     return $instance[$subroot->componentId];
 }
開發者ID:xiaoguizhidao,項目名稱:koala-framework,代碼行數:38,代碼來源:Lucene.php

示例2: __construct

 public function __construct()
 {
     Zend_Search_Lucene_Search_QueryParser::setDefaultEncoding('utf-8');
     //set default encoding
     Zend_Search_Lucene_Analysis_Analyzer::setDefault(new Zend_Search_Lucene_Analysis_Analyzer_CJK());
     //set default Analyzer
 }
開發者ID:uniqid,項目名稱:lucene,代碼行數:7,代碼來源:Indexes.php

示例3: __construct

 /**
  * Creates a new ZendLucene handler connection
  *
  * @param string $location
  */
 public function __construct($location)
 {
     /**
      * We're using realpath here because Zend_Search_Lucene does not do
      * that itself. It can cause issues because their destructor uses the
      * same filename but the cwd could have been changed.
      */
     $location = realpath($location);
     /* If the $location doesn't exist, ZSL throws a *generic* exception. We
      * don't care here though and just always assume it is because the
      * index does not exist. If it doesn't exist, we create it.
      */
     try {
         $this->connection = Zend_Search_Lucene::open($location);
     } catch (Zend_Search_Lucene_Exception $e) {
         $this->connection = Zend_Search_Lucene::create($location);
     }
     $this->inTransaction = 0;
     if (!$this->connection) {
         throw new ezcSearchCanNotConnectException('zendlucene', $location);
     }
     // Set proper default encoding for query parser
     Zend_Search_Lucene_Search_QueryParser::setDefaultEncoding('UTF-8');
     Zend_Search_Lucene_Analysis_Analyzer::setDefault(new Zend_Search_Lucene_Analysis_Analyzer_Common_Utf8Num_CaseInsensitive());
 }
開發者ID:jordanmanning,項目名稱:ezpublish,代碼行數:30,代碼來源:zend_lucene.php

示例4: __construct

 public function __construct()
 {
     $this->_log()->info('Starting up');
     if (@preg_match('/\\pL/u', 'a') != 1) {
         $this->_log()->err("PCRE unicode support is turned off.\n");
     }
     Zend_Search_Lucene_Search_QueryParser::setDefaultEncoding($this->_encoding);
     Zend_Search_Lucene_Analysis_Analyzer::setDefault(new Zend_Search_Lucene_Analysis_Analyzer_Common_Utf8Num_CaseInsensitive());
 }
開發者ID:rommmka,項目名稱:axiscommerce,代碼行數:9,代碼來源:Indexer.php

示例5: __construct

 public function __construct()
 {
     try {
         parent::__construct(new Zend_Search_Lucene(self::INDEX_DIR, false));
     } catch (Zend_Search_Lucene_Exception $e) {
         parent::__construct(new Zend_Search_Lucene(self::INDEX_DIR, true));
     }
     Zend_Search_Lucene_Search_QueryParser::setDefaultEncoding("UTF-8");
 }
開發者ID:rickboyau,項目名稱:magento-lucene,代碼行數:9,代碼來源:Index.php

示例6: renewIndex

 public static function renewIndex($forceCreate = false)
 {
     $pages = Application_Model_Mappers_PageMapper::getInstance()->getPagesForSearchIndex();
     if (!is_array($pages)) {
         return false;
     }
     Zend_Search_Lucene_Search_QueryParser::setDefaultEncoding('UTF-8');
     Zend_Search_Lucene_Analysis_Analyzer::setDefault(new Zend_Search_Lucene_Analysis_Analyzer_Common_Utf8_CaseInsensitive());
     self::removeIndex() && self::initIndex();
     array_walk($pages, array('Tools_Search_Tools', 'addPageToIndex'));
     self::$_index->optimize();
 }
開發者ID:PavloKovalov,項目名稱:seotoaster,代碼行數:12,代碼來源:Tools.php

示例7: registerZend

 public static function registerZend()
 {
     if (self::$zendLoaded) {
         return;
     }
     set_include_path(sfConfig::get('sf_lib_dir') . '/vendor' . PATH_SEPARATOR . get_include_path());
     require_once sfConfig::get('sf_lib_dir') . '/vendor/Zend/Loader/Autoloader.php';
     Zend_Loader_Autoloader::getInstance();
     Zend_Search_Lucene_Search_QueryParser::setDefaultEncoding('utf-8');
     Zend_Search_Lucene_Analysis_Analyzer::setDefault(new Zend_Search_Lucene_Analysis_Analyzer_Common_Utf8_CaseInsensitive());
     self::$zendLoaded = true;
 }
開發者ID:limitium,項目名稱:uberlov,代碼行數:12,代碼來源:ProjectConfiguration.class.php

示例8: actionSearch

 public function actionSearch()
 {
     $indexFiles = Yii::app()->getModule('zendsearch')->indexFiles;
     SetLocale(LC_ALL, 'ru_RU.UTF-8');
     Zend_Search_Lucene_Analysis_Analyzer::setDefault(new Zend_Search_Lucene_Analysis_Analyzer_Common_Utf8_CaseInsensitive());
     Zend_Search_Lucene_Search_QueryParser::setDefaultEncoding('UTF-8');
     if (($term = Yii::app()->getRequest()->getQuery('q', null)) !== null) {
         $index = new Zend_Search_Lucene(Yii::getPathOfAlias('application.' . $indexFiles));
         $results = $index->find($term);
         $query = Zend_Search_Lucene_Search_QueryParser::parse($term);
         $this->render('search', compact('results', 'term', 'query'));
     }
 }
開發者ID:sepaker,項目名稱:yupe,代碼行數:13,代碼來源:SearchController.php

示例9: __construct

 function __construct($directory, $lang = 'en', $highlight = true)
 {
     switch ($lang) {
         case 'en':
         default:
             Zend_Search_Lucene_Analysis_Analyzer::setDefault(new StandardAnalyzer_Analyzer_Standard_English());
             Zend_Search_Lucene_Search_QueryParser::setDefaultEncoding('UTF-8');
     }
     Zend_Search_Lucene_Storage_Directory_Filesystem::setDefaultFilePermissions(0660);
     $this->directory = $directory;
     $this->lastModif = file_exists($directory) ? filemtime($directory) : 0;
     $this->highlight = (bool) $highlight;
 }
開發者ID:jkimdon,項目名稱:cohomeals,代碼行數:13,代碼來源:Index.php

示例10: SiteSearch

 /**
  * Constructor method.
  */
 function SiteSearch()
 {
     if (!@file_exists($this->path . '/segments')) {
         $this->client = new Zend_Search_Lucene($this->path, true);
     } else {
         $this->client = new Zend_Search_Lucene($this->path);
     }
     Zend_Search_Lucene_Analysis_Analyzer::setDefault(new Zend_Search_Lucene_Analysis_Analyzer_Common_Utf8());
     ini_set('iconv.input_encoding', 'utf-8');
     ini_set('iconv.internal_encoding', 'utf-8');
     ini_set('iconv.output_encoding', 'utf-8');
     Zend_Search_Lucene_Search_QueryParser::setDefaultEncoding('utf-8');
     umask(00);
 }
開發者ID:vojtajina,項目名稱:sitellite,代碼行數:17,代碼來源:SiteSearch.php

示例11: getInstance

 /**
  * 
  * @return Zend_Search_Lucene_Interface
  */
 public static function getInstance()
 {
     if (self::$_instance === NULL) {
         $indexDir = APPLICATION_PATH . DIRECTORY_SEPARATOR . 'data' . DIRECTORY_SEPARATOR . 'lucene';
         Zend_Search_Lucene_Analysis_Analyzer::setDefault(new Zend_Search_Lucene_Analysis_Analyzer_Common_Utf8_CaseInsensitive());
         Zend_Search_Lucene_Search_QueryParser::setDefaultEncoding('utf-8');
         try {
             $index = Zend_Search_Lucene::open($indexDir);
         } catch (Exception $e) {
             $index = Zend_Search_Lucene::create($indexDir);
         }
         self::$_instance = $index;
     }
     return self::$_instance;
 }
開發者ID:Konstnantin,項目名稱:zf-app,代碼行數:19,代碼來源:Search.php

示例12: __construct

 public function __construct($config)
 {
     $this->indexFile = $config['indexFile'];
     $this->__setSources($config['source']);
     $this->indexDirectory = TMP;
     if (!empty($config['indexDirectory'])) {
         $this->indexDirectory = $config['indexDirectory'];
     }
     $this->__loadIndex($this->indexDirectory . $this->indexFile);
     Zend_Search_Lucene_Search_QueryParser::setDefaultEncoding(strtolower(Configure::read('App.encoding')));
     if (!empty($config['analyzer'])) {
         Zend_Search_Lucene_Analysis_Analyzer::setDefault(new $config['analyzer']());
     }
     parent::__construct($config);
 }
開發者ID:nkuitse,項目名稱:Guide-on-the-Side,代碼行數:15,代碼來源:ZendSearchLuceneSource.php

示例13: __construct

 public function __construct()
 {
     if (file_exists("Joobsbox/SearchIndexes/main")) {
         $this->_index = Zend_Search_Lucene::open("Joobsbox/SearchIndexes/main");
     } else {
         if (is_writable('Joobsbox/SearchIndexes')) {
             $this->_index = Zend_Search_Lucene::create("Joobsbox/SearchIndexes/main");
         } else {
             $this->_enabled = false;
         }
     }
     if ($this->_enabled) {
         Zend_Search_Lucene_Analysis_Analyzer::setDefault(new Zend_Search_Lucene_Analysis_Analyzer_Common_Utf8_CaseInsensitive());
         Zend_Search_Lucene_Search_QueryParser::setDefaultEncoding('utf-8');
     }
 }
開發者ID:ntulip,項目名稱:joobsbox-php,代碼行數:16,代碼來源:Search.php

示例14: __construct

 /**
  *  Initializes search model. If a Zend_Search_Lucene index is not found, one is created in /Joobsbox/SearchIndexes
  */
 public function __construct()
 {
     $this->_path = APPLICATION_DIRECTORY . "/Joobsbox/SearchIndexes/";
     if (file_exists($this->_path . "main")) {
         $this->index = Zend_Search_Lucene::open($this->_path . "main");
     } else {
         if (is_writable($this->_path)) {
             $this->index = Zend_Search_Lucene::create($this->_path . "main");
         } else {
             $this->enabled = false;
         }
     }
     if ($this->enabled) {
         Zend_Search_Lucene_Analysis_Analyzer::setDefault(new Zend_Search_Lucene_Analysis_Analyzer_Common_Utf8_CaseInsensitive());
         Zend_Search_Lucene_Search_QueryParser::setDefaultEncoding('utf-8');
     }
 }
開發者ID:hashemgamal,項目名稱:joobsbox-php,代碼行數:20,代碼來源:Search.php

示例15: get_Zend_Search_Lucene

 public function get_Zend_Search_Lucene($create_new_index = FALSE)
 {
     Zend_Search_Lucene_Search_QueryParser::setDefaultEncoding('utf-8');
     Zend_Search_Lucene_Analysis_Analyzer::setDefault(new Zend_Search_Lucene_Analysis_Analyzer_Common_Utf8_CaseInsensitive());
     if (self::$_indexer != NULL) {
         return self::$_indexer;
     }
     $search_lucene_directory = $this->CI->config->item('search_lucene_directory');
     $dir_path = $_SERVER['DOCUMENT_ROOT'] . $search_lucene_directory;
     //var_dump($dir_path); exit;
     //ApplicationHook::logInfo($dir_path);
     $files = get_filenames($dir_path);
     if (count($files) <= 1) {
         //not found index files, index as new
         $create_new_index = TRUE;
     }
     if ($create_new_index) {
         self::$_indexer = Zend_Search_Lucene::create($dir_path, TRUE);
     } else {
         self::$_indexer = Zend_Search_Lucene::open($dir_path);
     }
     return self::$_indexer;
 }
開發者ID:cyberformed,項目名稱:i2tree,代碼行數:23,代碼來源:Zend.php


注:本文中的Zend_Search_Lucene_Search_QueryParser::setDefaultEncoding方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。