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


PHP Zend_Search_Lucene_Interface::delete方法代码示例

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


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

示例1: index

 /**
  * Index a file
  *
  * @param   string  $filePath   The file path
  */
 public function index($filePath)
 {
     $content = file_get_contents($filePath);
     $modificationTime = filemtime($filePath);
     $checksum = md5($content);
     // Get the document
     $hits = $this->_data->find('path:' . $filePath);
     if (count($hits) > 0) {
         $hit = $hits[0];
         $document = $hit->getDocument();
         // If the checksums are the same, no need to update
         if ($checksum === $document->checksum) {
             return;
         }
         // Delete the document
         $this->_data->delete($hit);
     }
     // Create a new document
     $document = new Zend_Search_Lucene_Document();
     $document->addField(Zend_Search_Lucene_Field::keyword('path', $filePath));
     $document->addField(Zend_Search_Lucene_Field::keyword('modificationTime', $modificationTime));
     $document->addField(Zend_Search_Lucene_Field::keyword('checksum', $checksum));
     $document->addField(Zend_Search_Lucene_Field::unStored('content', $content, 'utf-8'));
     $this->_data->addDocument($document);
     // Commit the changes
     $this->_data->commit();
     $this->_data->optimize();
 }
开发者ID:neolao,项目名称:wiki,代码行数:33,代码来源:Search.php

示例2: delete_post

 /**
  * Remove  a post from the index
  *
  * @param Post $post the post being deleted
  */
 public function delete_post($post)
 {
     $term = new Zend_Search_Lucene_Index_Term($post->id, 'postid');
     $docIds = $this->_index->termDocs($term);
     foreach ($docIds as $id) {
         $this->_index->delete($id);
     }
 }
开发者ID:habari-extras,项目名称:multisearch,代码行数:13,代码来源:zendsearchlucene.php

示例3: removeFromIndex

 public static function removeFromIndex($term)
 {
     $websiteHelper = Zend_Controller_Action_HelperBroker::getStaticHelper('website');
     $searchIndexFolder = $websiteHelper->getPath() . 'cache/' . Widgets_Search_Search::INDEX_FOLDER;
     if (!is_dir($searchIndexFolder)) {
         return false;
     }
     if (!self::initIndex()) {
         return false;
     }
     $hits = self::$_index->find(strval($term));
     if (is_array($hits) && !empty($hits)) {
         foreach ($hits as $hit) {
             self::$_index->delete($hit->id);
         }
         return true;
     }
     return false;
 }
开发者ID:PavloKovalov,项目名称:seotoaster,代码行数:19,代码来源:Tools.php

示例4: delete

 /**
  * Remove a record from the search index
  *
  * @param string $value
  * @param string $searchField
  * @return Zym_Search_Lucene_Index
  */
 public function delete($value, $searchField = null)
 {
     if (!$searchField) {
         $searchField = $this->_idKey;
     }
     $documentIds = $this->getDocumentIds($value, $searchField);
     foreach ($documentIds as $id) {
         $this->_searchIndex->delete($id);
     }
     return $this;
 }
开发者ID:BGCX262,项目名称:zym-svn-to-git,代码行数:18,代码来源:Index.php

示例5: delete

 /**
  * Deletes a document from the index.
  * $id is an internal document id
  *
  * @param integer|Zend_Search_Lucene_Search_QueryHit $id
  * @throws Zend_Search_Lucene_Exception
  */
 public function delete($id)
 {
     return $this->_index->delete($id);
 }
开发者ID:abdulhadikaryana,项目名称:kebudayaan,代码行数:11,代码来源:Proxy.php


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