• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP Zend_Search_Lucene_Document类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: luceneIndexAction

 public function luceneIndexAction()
 {
     $this->view->layout()->disableLayout();
     $this->_helper->viewRenderer->setNoRender(true);
     $path = PUBLIC_PATH . '/tmp/lucene';
     try {
         $index = Zend_Search_Lucene::open($path);
     } catch (Zend_Search_Lucene_Exception $e) {
         try {
             $index = Zend_Search_Lucene::create($path);
         } catch (Zend_Search_Lucene_Exception $e) {
             echo "Unable to open or create index : {$e->getMessage()}";
         }
     }
     for ($i = 0; $i < $index->maxDoc(); $i++) {
         $index->delete($i);
     }
     $users = new Application_Model_User();
     $users = $users->fetchAll();
     foreach ($users as $_user) {
         Zend_Search_Lucene_Analysis_Analyzer::setDefault(new Zend_Search_Lucene_Analysis_Analyzer_Common_TextNum_CaseInsensitive());
         $doc = new Zend_Search_Lucene_Document();
         $doc->addField(Zend_Search_Lucene_Field::Text('title', $_user->getFirstName()));
         $doc->addField(Zend_Search_Lucene_Field::keyword('empcode', $_user->getEmployeeCode()));
         $index->addDocument($doc);
         $index->commit();
         $index->optimize();
     }
 }
开发者ID:riteshsahu1981,项目名称:we,代码行数:29,代码来源:ImageController.php


示例2: updateLuceneIndex

 public function updateLuceneIndex()
 {
     //delete existing entries
     $index = $this->getTable()->getLuceneIndex();
     // remove existing entries
     foreach ($index->find('pk:' . $this->getId()) as $hit) {
         $index->delete($hit->id);
     }
     // create new Lucene document
     $doc = new Zend_Search_Lucene_Document();
     // store product primary key to identify it in the search results
     $doc->addField(Zend_Search_Lucene_Field::Keyword('pk', $this->getId()));
     $tr = Doctrine::getTable('ProductTranslation')->createQuery()->from('ProductTranslation pt')->where('pt.id = ?', $this->getId())->execute();
     $doc->addField(Zend_Search_Lucene_Field::UnStored('original_title', $this->getOriginalTitle(), 'utf-8'));
     // add fields to index depending on existing Translations
     foreach ($tr->toArray() as $transArr) {
         $lang = $transArr['lang'];
         unset($transArr['lang'], $transArr['id'], $transArr['volume'], $transArr['slug']);
         foreach ($transArr as $field => $value) {
             $fieldName = $field . '_' . $lang;
             // (name_en, name_fi),  (description_en, description_fi)
             $doc->addField(Zend_Search_Lucene_Field::UnStored($fieldName, strip_tags($value), 'utf-8'));
         }
     }
     // add product to the index
     $index->addDocument($doc);
     $index->commit();
 }
开发者ID:vcgato29,项目名称:poff,代码行数:28,代码来源:Product.class.php


示例3: testAddFieldMethodChaining

 public function testAddFieldMethodChaining()
 {
     $document = new Zend_Search_Lucene_Document();
     $this->assertTrue($document->addField(Zend_Search_Lucene_Field::Text('title', 'Title')) instanceof Zend_Search_Lucene_Document);
     $document = new Zend_Search_Lucene_Document();
     $document->addField(Zend_Search_Lucene_Field::Text('title', 'Title'))->addField(Zend_Search_Lucene_Field::Text('annotation', 'Annotation'))->addField(Zend_Search_Lucene_Field::Text('body', 'Document body, document body, document body...'));
 }
开发者ID:lortnus,项目名称:zf1,代码行数:7,代码来源:DocumentTest.php


示例4: addPageToIndex

 public static function addPageToIndex($page, $toasterSearchIndex = false)
 {
     if (!self::initIndex()) {
         return false;
     }
     if ($page instanceof Application_Model_Models_Page) {
         $page = $page->toArray();
         $containers = Application_Model_Mappers_ContainerMapper::getInstance()->findByPageId($page['id']);
         $page['content'] = '';
         if (!empty($containers)) {
             foreach ($containers as $container) {
                 $page['content'] .= $container->getContent();
             }
         }
     }
     $document = new Zend_Search_Lucene_Document();
     $document->addField(Zend_Search_Lucene_Field::keyword('pageId', $page['id']));
     $document->addField(Zend_Search_Lucene_Field::unStored('metaKeyWords', $page['metaKeywords'], 'UTF-8'));
     $document->addField(Zend_Search_Lucene_Field::unStored('metaDescription', $page['metaDescription'], 'UTF-8'));
     $document->addField(Zend_Search_Lucene_Field::unStored('headerTitle', $page['headerTitle'], 'UTF-8'));
     $document->addField(Zend_Search_Lucene_Field::unStored('content', $page['content'], 'UTF-8'));
     $document->addField(Zend_Search_Lucene_Field::text('draft', $page['draft'], 'UTF-8'));
     $document->addField(Zend_Search_Lucene_Field::text('teaserText', $page['teaserText'], 'UTF-8'));
     $document->addField(Zend_Search_Lucene_Field::text('url', $page['url'], 'UTF-8'));
     $document->addField(Zend_Search_Lucene_Field::text('navName', $page['navName'], 'UTF-8'));
     $document->addField(Zend_Search_Lucene_Field::text('h1', $page['h1'], 'UTF-8'));
     //		$document->addField(Zend_Search_Lucene_Field::text('previewImage', $page['previewImage']));
     self::$_index->addDocument($document);
 }
开发者ID:PavloKovalov,项目名称:seotoaster,代码行数:29,代码来源:Tools.php


示例5: addDocument

 /**
  * Adds a document to this segment.
  *
  * @param Zend_Search_Lucene_Document $document
  * @throws Zend_Search_Lucene_Exception
  */
 public function addDocument(Zend_Search_Lucene_Document $document)
 {
     $storedFields = array();
     $docNorms = array();
     $similarity = Zend_Search_Lucene_Search_Similarity::getDefault();
     foreach ($document->getFieldNames() as $fieldName) {
         $field = $document->getField($fieldName);
         $this->addField($field);
         if ($field->storeTermVector) {
             /**
              * @todo term vector storing support
              */
             throw new Zend_Search_Lucene_Exception('Store term vector functionality is not supported yet.');
         }
         if ($field->isIndexed) {
             if ($field->isTokenized) {
                 $tokenList = Zend_Search_Lucene_Analysis_Analyzer::getDefault()->tokenize($field->stringValue);
             } else {
                 $tokenList = array();
                 $tokenList[] = new Zend_Search_Lucene_Analysis_Token($field->stringValue, 0, strlen($field->stringValue));
             }
             $docNorms[$field->name] = chr($similarity->encodeNorm($similarity->lengthNorm($field->name, count($tokenList))));
             $position = 0;
             foreach ($tokenList as $token) {
                 $term = new Zend_Search_Lucene_Index_Term($token->getTermText(), $field->name);
                 $termKey = $term->key();
                 if (!isset($this->_termDictionary[$termKey])) {
                     // New term
                     $this->_termDictionary[$termKey] = $term;
                     $this->_termDocs[$termKey] = array();
                     $this->_termDocs[$termKey][$this->_docCount] = array();
                 } else {
                     if (!isset($this->_termDocs[$termKey][$this->_docCount])) {
                         // Existing term, but new term entry
                         $this->_termDocs[$termKey][$this->_docCount] = array();
                     }
                 }
                 $position += $token->getPositionIncrement();
                 $this->_termDocs[$termKey][$this->_docCount][] = $position;
             }
         }
         if ($field->isStored) {
             $storedFields[] = $field;
         }
     }
     foreach ($this->_fields as $fieldName => $field) {
         if (!$field->isIndexed) {
             continue;
         }
         if (!isset($this->_norms[$fieldName])) {
             $this->_norms[$fieldName] = str_repeat(chr($similarity->encodeNorm($similarity->lengthNorm($fieldName, 0))), $this->_docCount);
         }
         if (isset($docNorms[$fieldName])) {
             $this->_norms[$fieldName] .= $docNorms[$fieldName];
         } else {
             $this->_norms[$fieldName] .= chr($similarity->encodeNorm($similarity->lengthNorm($fieldName, 0)));
         }
     }
     $this->addStoredFields($storedFields);
 }
开发者ID:BackupTheBerlios,项目名称:openpublisher-svn,代码行数:66,代码来源:DocumentWriter.php


示例6: buildplaces

 public function buildplaces()
 {
     ini_set('memory_limit', '1000M');
     set_time_limit(0);
     $time = time();
     Zend_Search_Lucene_Analysis_Analyzer::setDefault(new Zend_Search_Lucene_Analysis_Analyzer_Common_Utf8Num_CaseInsensitive());
     /**
      * Create index
      */
     $index = Zend_Search_Lucene::create($this->_indexPath);
     /**
      * Get all users
      */
     $sql = $this->_db->select()->from($this->_name, array('id', 'name', 'placepic'))->limit(7500);
     $result = $this->_db->fetchAssoc($sql);
     foreach ($result as $values) {
         $doc = new Zend_Search_Lucene_Document();
         $doc->addField(Zend_Search_Lucene_Field::keyword('placeid', $values['id']));
         $doc->addField(Zend_Search_Lucene_Field::text('placename', $values['name']));
         $doc->addField(Zend_Search_Lucene_Field::unStored('placepic', $values['placepic']));
         $index->addDocument($doc);
     }
     $index->commit();
     $elapsed = time() - $time;
     print_r($elapsed);
 }
开发者ID:abdulnizam,项目名称:zend-freniz,代码行数:26,代码来源:places.php


示例7: index

 function index()
 {
     $this->load->library('zend', 'Zend/Feed');
     $this->load->library('zend', 'Zend/Search/Lucene');
     $this->load->library('zend');
     $this->zend->load('Zend/Feed');
     $this->zend->load('Zend/Search/Lucene');
     //Create index.
     $index = new Zend_Search_Lucene('C:\\xampp\\xampp\\htdocs\\controle_frota\\lucene\\feeds_index', true);
     $feeds = array('http://oglobo.globo.com/rss.xml?limite=50');
     //grab each feed.
     foreach ($feeds as $feed) {
         $channel = Zend_Feed::import($feed);
         echo $channel->title() . '<br />';
         //index each item.
         foreach ($channel->items as $item) {
             if ($item->link() && $item->title() && $item->description()) {
                 //create an index doc.
                 $doc = new Zend_Search_Lucene_Document();
                 $doc->addField(Zend_Search_Lucene_Field::Keyword('link', $this->sanitize($item->link())));
                 $doc->addField(Zend_Search_Lucene_Field::Text('title', $this->sanitize($item->title())));
                 $doc->addField(Zend_Search_Lucene_Field::Unstored('contents', $this->sanitize($item->description())));
                 echo "\tAdding: " . $item->title() . '<br />';
                 $index->addDocument($doc);
             }
         }
     }
     $index->commit();
     echo $index->count() . ' Documents indexed.<br />';
 }
开发者ID:ramonsilvanet,项目名称:controle-frota-php,代码行数:30,代码来源:pesquisas.php


示例8: index_lucene

function index_lucene($article, $optimise)
{
    $index = getIndex_lucene();
    $term = new Zend_Search_Lucene_Index_Term($article["PMID"], 'PMID');
    // a pre-existing page cannot be updated, it has to be
    // deleted, and indexed again:
    $exactSearchQuery = new Zend_Search_Lucene_Search_Query_Term($term);
    $hits = $index->find($exactSearchQuery);
    if (count($hits) > 0) {
        echo "[deleting previous version]\n";
        foreach ($hits as $hit) {
            $index->delete($hit->id);
        }
    }
    $doc = new Zend_Search_Lucene_Document();
    $doc->addField(Zend_Search_Lucene_Field::Keyword('PMID', $article["PMID"]));
    $doc->addField(Zend_Search_Lucene_Field::Keyword('Year', $article["Year"]));
    $doc->addField(Zend_Search_Lucene_Field::Keyword('Journal', $article["Journal"]));
    $doc->addField(Zend_Search_Lucene_Field::Text('Title', $article["Title"], 'utf-8'));
    $doc->addField(Zend_Search_Lucene_Field::Text('Authors', $article["Authors"], 'utf-8'));
    $doc->addField(Zend_Search_Lucene_Field::Text('Reference', $article["Reference"], 'utf-8'));
    $doc->addField(Zend_Search_Lucene_Field::UnStored('Abstract', $article["Abstract"], 'utf-8'));
    $doc->addField(Zend_Search_Lucene_Field::Text('MeshHeadings', $article["MeshHeadings"], 'utf-8'));
    $index->addDocument($doc);
    if ($optimise) {
        echo "Optimising index\n";
        $index->optimize();
    }
    $index->commit();
    echo "The index contains " . $index->numDocs() . " documents\n";
}
开发者ID:jbpoline,项目名称:brainspell,代码行数:31,代码来源:admin-upload-papers.php


示例9: addJob

 public function addJob($jobData)
 {
     if (!$this->_enabled) {
         return false;
     }
     // Delete old job with the same id from index
     $term = new Zend_Search_Lucene_Index_Term($jobData['id'], 'id');
     $hits = $this->_index->termDocs($term);
     if (count($hits)) {
         foreach ($hits as $hit) {
             $this->_index->delete($hit->id);
         }
     }
     // Add the job now
     $job = new Zend_Search_Lucene_Document();
     $job->addField(Zend_Search_Lucene_Field::Keyword('DocumentType', 'job', 'utf-8'));
     $job->addField(Zend_Search_Lucene_Field::Keyword('id', $jobData['id'], 'utf-8'));
     $job->addField(Zend_Search_Lucene_Field::Text('title', $jobData['title'], 'utf-8'));
     $job->addField(Zend_Search_Lucene_Field::Text('description', $jobData['description'], 'utf-8'));
     $job->addField(Zend_Search_Lucene_Field::Text('company', $jobData['company'], 'utf-8'));
     $job->addField(Zend_Search_Lucene_Field::Keyword('categoryid', $jobData['categoryid'], 'utf-8'));
     $job->addField(Zend_Search_Lucene_Field::Text('location', $jobData['location'], 'utf-8'));
     $this->_index->addDocument($job);
     $this->_index->commit();
 }
开发者ID:ntulip,项目名称:joobsbox-php,代码行数:25,代码来源:Search.php


示例10: IndexBug

 public function IndexBug($bug)
 {
     $this->RemoveBug($bug->bug_id);
     $doc = new Zend_Search_Lucene_Document();
     $doc->AddField(Zend_Search_Lucene_Field::Keyword('bug_id', $bug->bug_id));
     $doc->AddField(Zend_Search_Lucene_Field::Text('title', $bug->title));
     $doc->AddField(Zend_Search_Lucene_Field::Keyword('reporting_user_id', $bug->reporting_user_id));
     $doc->AddField(Zend_Search_Lucene_Field::Keyword('reporting_date', $bug->reporting_date));
     // We concatenate all comments into a single text blob. We only show
     // hits as bugs, but we want comment content to matter.
     $comment_blob = '';
     $stmt = Bugdar::$db->Prepare("SELECT body FROM " . TABLE_PREFIX . "comments WHERE bug_id = ? ORDER BY comment_id");
     $stmt->Execute(array($bug->bug_id));
     while ($comment = $stmt->FetchObject()) {
         $comment_blob .= $comment->body . "\n\n";
     }
     $doc->AddField(Zend_Search_Lucene_Field::UnStored('comments', $comment_blob));
     // Add all attributes.
     $stmt = Bugdar::$db->Prepare("SELECT * FROM " . TABLE_PREFIX . "bug_attributes WHERE bug_id = ?");
     $stmt->Execute(array($bug->bug_id));
     $tags = array();
     while ($attr = $stmt->FetchObject()) {
         if ($attr->attribute_title) {
             $doc->AddField(Zend_Search_Lucene_Field::Keyword($attr->attribute_title, $attr->value));
         } else {
             $tags[] = $attr->value;
         }
     }
     $doc->AddField(Zend_Search_Lucene_Field::Text('tag', implode(' ', $tags)));
     $this->lucene->AddDocument($doc);
 }
开发者ID:rsesek,项目名称:Bugdar2,代码行数:31,代码来源:search_engine.php


示例11: actionIndexing

 /**
  * This is the default 'index' action that is invoked
  * when an action is not explicitly requested by users.
  */
 public function actionIndexing()
 {
     ini_set('max_execution_time', 0);
     ob_start();
     $index = new Zend_Search_Lucene(Yii::getPathOfAlias($this->_indexFilesPath), true);
     $criteria = new CDbCriteria();
     $criteria->compare('t.publish', 1);
     $criteria->order = 'album_id DESC';
     //$criteria->limit = 10;
     $model = Albums::model()->findAll($criteria);
     foreach ($model as $key => $item) {
         if ($item->media_id != 0) {
             $images = Yii::app()->request->baseUrl . '/public/album/' . $item->album_id . '/' . $item->cover->media;
         } else {
             $images = '';
         }
         $doc = new Zend_Search_Lucene_Document();
         $doc->addField(Zend_Search_Lucene_Field::UnIndexed('id', CHtml::encode($item->album_id), 'utf-8'));
         $doc->addField(Zend_Search_Lucene_Field::Text('media', CHtml::encode($images), 'utf-8'));
         $doc->addField(Zend_Search_Lucene_Field::Text('title', CHtml::encode($item->title), 'utf-8'));
         $doc->addField(Zend_Search_Lucene_Field::Text('body', CHtml::encode(Utility::hardDecode(Utility::softDecode($item->body))), 'utf-8'));
         $doc->addField(Zend_Search_Lucene_Field::Text('url', CHtml::encode(Utility::getProtocol() . '://' . Yii::app()->request->serverName . Yii::app()->createUrl('album/site/view', array('id' => $item->album_id, 't' => Utility::getUrlTitle($item->title)))), 'utf-8'));
         $doc->addField(Zend_Search_Lucene_Field::UnIndexed('date', CHtml::encode(Utility::dateFormat($item->creation_date, true) . ' WIB'), 'utf-8'));
         $doc->addField(Zend_Search_Lucene_Field::UnIndexed('creation', CHtml::encode($item->user->displayname), 'utf-8'));
         $index->addDocument($doc);
     }
     echo 'Album Lucene index created';
     $index->commit();
     $this->redirect(Yii::app()->createUrl('article/search/indexing'));
     ob_end_flush();
 }
开发者ID:OmmuOpenSource,项目名称:OOS-Company-Profile,代码行数:35,代码来源:SearchController.php


示例12: updateIndex

 /**
  * Updates the index for an object
  *
  * @param Doctrine_Record $object
  */
 public function updateIndex(Doctrine_Record $object, $delete = false)
 {
     /* error checking */
     if (!array_key_exists('models', $this->config) || empty($this->config['models'])) {
         throw new Exception(sprintf('No models set in search.yml', $name));
     }
     if (!array_key_exists($model = get_class($object), $this->config['models'])) {
         throw new Exception(sprintf('Model "%s" not defined in "%s" index in your search.yml', $model, $this->name));
     }
     $id = $this->generateId($object->getId(), $model);
     $config = $this->config['models'][$model];
     //delete existing entries
     foreach ($this->search('_id:"' . $id . '"') as $hit) {
         $this->getIndex()->delete($hit->id);
     }
     if ($delete) {
         return;
     }
     //only add to search if canSearch method on model returns true (search if no method exists)
     if (method_exists($object, 'canSearch')) {
         if (!call_user_func(array($object, 'canSearch'))) {
             return;
         }
     }
     $doc = new Zend_Search_Lucene_Document();
     // store a key for deleting in future
     $doc->addField(Zend_Search_Lucene_Field::Keyword('_id', $id));
     // store job primary key and model name to identify it in the search results
     $doc->addField(Zend_Search_Lucene_Field::Keyword('_pk', $object->getId()));
     $doc->addField(Zend_Search_Lucene_Field::Keyword('_model', $model));
     // store title - used for search result title
     if (!array_key_exists('title', $config)) {
         throw new Exception(sprintf('A title must be set for model "%s" in search.yml', $model));
     }
     $doc->addField(Zend_Search_Lucene_Field::unIndexed('_title', call_user_func(array($object, 'get' . sfInflector::camelize($config['title'])))));
     // store description - used for search result description
     if (!array_key_exists('description', $config)) {
         throw new Exception(sprintf('A description must be set for model "%s" in search.yml', $model));
     }
     $doc->addField(Zend_Search_Lucene_Field::unIndexed('_description', call_user_func(array($object, 'get' . sfInflector::camelize($config['description'])))));
     // store url - @todo add more routing options
     if (!array_key_exists('route', $config)) {
         throw new Exception(sprintf('A route must be set for model "%s" in search.yml', $model));
     }
     sfContext::getInstance()->getConfiguration()->loadHelpers('Url');
     $url = url_for($config['route'], $object);
     $doc->addField(Zend_Search_Lucene_Field::unIndexed('_url', $url));
     //store fields
     if (array_key_exists('fields', $config)) {
         foreach ($config['fields'] as $field => $config) {
             $doc->addField(Zend_Search_Lucene_Field::UnStored($field, call_user_func(array($object, 'get' . sfInflector::camelize($field))), 'utf-8'));
         }
     }
     //save index
     $this->getIndex()->addDocument($doc);
     $this->getIndex()->commit();
 }
开发者ID:kbond,项目名称:zsUtilPlugin,代码行数:62,代码来源:zsSearchIndex.class.php


示例13: build_index

 /**
  * rebuild the index
  *
  * @access public
  * @return void
  */
 function build_index()
 {
     $index = $this->__open(true);
     $index->setMergeFactor(2000);
     $index->setMaxBufferedDocs(500);
     $start = time();
     foreach ($this->settings as $model => $model_options) {
         App::import('Model', $model);
         $model = new $model();
         if (empty($model_options['find_options'])) {
             $model_options['find_options'] = array();
         }
         if (method_exists($model, 'find_index')) {
             $results = $model->find_index('all', $model_options['find_options']);
         } else {
             $results = $model->find('all', $model_options['find_options']);
         }
         if (Configure::read()) {
             $this->log($model->name . ' find time: ' . (time() - $start), 'searchable');
             $start = time();
         }
         $count = count($results);
         $i = 1;
         foreach ($results as $result) {
             printf("%.1f", $i / $count * 100);
             $this->out("");
             $i++;
             $this->out('Processing ' . $model->name . ' #' . $result[$model->name]['id']);
             $doc = new Zend_Search_Lucene_Document();
             // add the model field
             $doc->addField(Zend_Search_Lucene_Field::Keyword('cake_model', $model->name, 'utf-8'));
             foreach ($model_options['fields'] as $field_name => $options) {
                 if (!empty($options['prepare']) && function_exists($options['prepare'])) {
                     $result[$model->name][$field_name] = call_user_func($options['prepare'], $result[$model->name][$field_name]);
                 }
                 $alias = !empty($options['alias']) ? $options['alias'] : $field_name;
                 $doc->addField(Zend_Search_Lucene_Field::$options['type']($alias, $result[$model->name][$field_name], 'utf-8'));
             }
             $index->addDocument($doc);
             $this->out('Processed ' . $model->name . ' #' . $result[$model->name]['id']);
         }
         if (Configure::read()) {
             $this->log($model->name . ' adding time: ' . (time() - $start), 'searchable');
             $start = time();
         }
     }
     $this->optimize($index);
     $index->commit();
     if (Configure::read()) {
         $this->log('Optimize+commit time: ' . (time() - $start));
     }
 }
开发者ID:sdoney,项目名称:cookbook,代码行数:58,代码来源:search.php


示例14: fill_index

function fill_index()
{
    for ($i = 0; $i < 10; $i++) {
        $index = new Zend_Search_Lucene('./data/index', true);
        $index->find("test");
        $doc = new Zend_Search_Lucene_Document();
        $doc->addField(Zend_Search_Lucene_Field::Text("test", getword()));
        $doc->addField(Zend_Search_Lucene_Field::UnStored("contents", getword()));
        $index->addDocument($doc);
        $index->commit();
        $index->getDirectory()->close();
        //comment this to see another bug :-|
    }
}
开发者ID:Tony133,项目名称:zf-web,代码行数:14,代码来源:search_test.php


示例15: compact

         $results = $index->find($term);
         $query = Zend_Search_Lucene_Search_QueryParser::parse($term);
         $this->render('/sParameter/search', compact('results', 'term', 'query'));
     }
 }
 /**
  * Search index creation
  */
 public function actionCreate()
 {
     $index = new Zend_Search_Lucene(Yii::getPathOfAlias('application.' . $this->_indexFiles), true);
     $posts = tAccount::model()->findAll();
     foreach ($posts as $post) {
         $doc = new Zend_Search_Lucene_Document();
         $doc->addField(Zend_Search_Lucene_Field::Text('account_no', CHtml::encode($post->account_no), 'utf-8'));
开发者ID:kit9,项目名称:ERP_Accounting_Indonesia,代码行数:15,代码来源:_OLD_SearchController.php


示例16: setUpBeforeClass

 /**
  * This method is called before the first test of this test class is run.
  *
  * Build a temporary index with a couple of documents
  */
 public static function setUpBeforeClass()
 {
     // ensure no index exist
     system(sprintf("rm -rf %s", self::indexDir()));
     // create the index
     $index = Zend_Search_Lucene::create(self::indexDir());
     // add some documents
     for ($i = 0; $i < 3; $i++) {
         $document = new Zend_Search_Lucene_Document();
         $document->addField(Zend_Search_Lucene_Field::text('title', "foo bar baz {$i}"));
         $document->addField(Zend_Search_Lucene_Field::text('content', 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nunc pharetra laoreet sodales. Aenean consequat ornare aliquam. Etiam vestibulum ultrices elit nec vestibulum'));
         $index->addDocument($document);
     }
     $index->commit();
 }
开发者ID:JellyBellyDev,项目名称:zle,代码行数:20,代码来源:LuceneTest.php


示例17: makeDoc

    /**
     * Construct a Zend_Search_Lucene_Document object out of an announcement db row.
     * 
     * @global string $urlServer
     * @param  object  $announce
     * @return Zend_Search_Lucene_Document
     */
    protected function makeDoc($announce) {
        global $urlServer;
        $encoding = 'utf-8';

        $doc = new Zend_Search_Lucene_Document();
        $doc->addField(Zend_Search_Lucene_Field::Keyword('pk', 'announce_' . $announce->id, $encoding));
        $doc->addField(Zend_Search_Lucene_Field::Keyword('pkid', $announce->id, $encoding));
        $doc->addField(Zend_Search_Lucene_Field::Keyword('doctype', 'announce', $encoding));
        $doc->addField(Zend_Search_Lucene_Field::Keyword('courseid', $announce->course_id, $encoding));
        $doc->addField(Zend_Search_Lucene_Field::Text('title', Indexer::phonetics($announce->title), $encoding));
        $doc->addField(Zend_Search_Lucene_Field::Text('content', Indexer::phonetics(strip_tags($announce->content)), $encoding));
        $doc->addField(Zend_Search_Lucene_Field::Text('visible', $announce->visible, $encoding));
        $doc->addField(Zend_Search_Lucene_Field::UnIndexed('url', $urlServer . 'modules/announcements/index.php?course=' . course_id_to_code($announce->course_id) . '&amp;an_id=' . $announce->id, $encoding));

        return $doc;
    }
开发者ID:nikosv,项目名称:openeclass,代码行数:23,代码来源:announcementindexer.class.php


示例18: makeDoc

    /**
     * Construct a Zend_Search_Lucene_Document object out of an exercise db row.
     * 
     * @global string $urlServer
     * @param  object  $exercise
     * @return Zend_Search_Lucene_Document
     */
    protected function makeDoc($exercise) {
        global $urlServer;
        $encoding = 'utf-8';

        $doc = new Zend_Search_Lucene_Document();
        $doc->addField(Zend_Search_Lucene_Field::Keyword('pk', 'exercise_' . $exercise->id, $encoding));
        $doc->addField(Zend_Search_Lucene_Field::Keyword('pkid', $exercise->id, $encoding));
        $doc->addField(Zend_Search_Lucene_Field::Keyword('doctype', 'exercise', $encoding));
        $doc->addField(Zend_Search_Lucene_Field::Keyword('courseid', $exercise->course_id, $encoding));
        $doc->addField(Zend_Search_Lucene_Field::Text('title', Indexer::phonetics($exercise->title), $encoding));
        $doc->addField(Zend_Search_Lucene_Field::Text('content', Indexer::phonetics(strip_tags($exercise->description)), $encoding));
        $doc->addField(Zend_Search_Lucene_Field::Text('visible', $exercise->active, $encoding));
        $doc->addField(Zend_Search_Lucene_Field::UnIndexed('url', $urlServer . 'modules/exercise/exercise_submit.php?course=' . course_id_to_code($exercise->course_id) . '&amp;exerciseId=' . $exercise->id, $encoding));

        return $doc;
    }
开发者ID:nikosv,项目名称:openeclass,代码行数:23,代码来源:exerciseindexer.class.php


示例19: addFeed

 public function addFeed(Feed $feed)
 {
     $index = Zend_Search_Lucene::open(Zend_Registry::getInstance()->search->feed);
     $doc = new Zend_Search_Lucene_Document();
     $doc->addField(Zend_Search_Lucene_Field::Text('title', $feed->title));
     $doc->addField(Zend_Search_Lucene_Field::Text('siteUrl', $feed->siteUrl));
     $doc->addField(Zend_Search_Lucene_Field::Text('feedUrl', $feed->url));
     $doc->addField(Zend_Search_Lucene_Field::Text('language', $feed->language));
     $doc->addField(Zend_Search_Lucene_Field::Text('category', $feed->category));
     $doc->addField(Zend_Search_Lucene_Field::Text('title', $feed->title));
     $doc->addField(Zend_Search_Lucene_Field::UnStored('description', $feed->description));
     $index->addDocument($doc);
 }
开发者ID:aprondak,项目名称:ifphp,代码行数:13,代码来源:Search.php


示例20: makeDoc

    /**
     * Construct a Zend_Search_Lucene_Document object out of a link db row.
     * 
     * @global string $urlServer
     * @param  object  $link
     * @return Zend_Search_Lucene_Document
     */
    protected function makeDoc($link) {
        $encoding = 'utf-8';

        $doc = new Zend_Search_Lucene_Document();
        $doc->addField(Zend_Search_Lucene_Field::Keyword('pk', 'link_' . $link->id, $encoding));
        $doc->addField(Zend_Search_Lucene_Field::Keyword('pkid', $link->id, $encoding));
        $doc->addField(Zend_Search_Lucene_Field::Keyword('doctype', 'link', $encoding));
        $doc->addField(Zend_Search_Lucene_Field::Keyword('courseid', $link->course_id, $encoding));
        $doc->addField(Zend_Search_Lucene_Field::Text('title', Indexer::phonetics($link->title), $encoding));
        $doc->addField(Zend_Search_Lucene_Field::Text('content', Indexer::phonetics(strip_tags($link->description)), $encoding));
        $doc->addField(Zend_Search_Lucene_Field::UnIndexed('url', $link->url, $encoding));

        return $doc;
    }
开发者ID:nikosv,项目名称:openeclass,代码行数:21,代码来源:linkindexer.class.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP Zend_Search_Lucene_Document_Html类代码示例发布时间:2022-05-23
下一篇:
PHP Zend_Search_Lucene_Analysis_Token类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap