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


PHP Zend_Search_Lucene_Field::unStored方法代码示例

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


在下文中一共展示了Zend_Search_Lucene_Field::unStored方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: 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

示例3: __construct

 public function __construct(Storefront_Resource_Product_Item_Interface $item, $category)
 {
     $this->addField(Zend_Search_Lucene_Field::keyword('productId', $item->productId, 'UTF-8'));
     $this->addField(Zend_Search_Lucene_Field::text('categories', $category, 'UTF-8'));
     $this->addField(Zend_Search_Lucene_Field::text('name', $item->name, 'UTF-8'));
     $this->addField(Zend_Search_Lucene_Field::unStored('description', $item->description, 'UTF-8'));
     $this->addField(Zend_Search_Lucene_Field::text('price', $this->_formatPrice($item->getPrice()), 'UTF-8'));
 }
开发者ID:AkimBolushbek,项目名称:zendframeworkstorefront,代码行数:8,代码来源:Product.php

示例4: updateLuceneIndex

 public function updateLuceneIndex()
 {
     $index = articuloTable::getLuceneIndex();
     $hit = $index->find('pk:' . $this->getId());
     if ($hit) {
         $index->delete($hit->id);
     }
     $doc = new Zend_Search_Lucene_Document();
     $doc->addField(Zend_Search_Lucene_Field::unIndexed('pk', $this->getId()));
     $doc->addField(Zend_Search_Lucene_Field::unStored('marca', $this->getMarca(), 'utf-8'));
     $doc->addField(Zend_Search_Lucene_Field::unStored('categoria', $this->getCategoria(), 'utf-8'));
     $doc->addField(Zend_Search_Lucene_Field::unStored('descripcion', $this->getDescripcion(), 'utf-8'));
     $index->addDocument($doc);
     $index->commit();
 }
开发者ID:recchia,项目名称:solmed,代码行数:15,代码来源:articulo.class.php

示例5: updateLuceneIndex

 public function updateLuceneIndex()
 {
     $index = GcMailboxPeer::getLuceneIndex();
     //borrar las entradas existentes
     if ($hit = $index->find('pk:' . $this->getId())) {
         $index->delete($hit->id);
     }
     //no indexar buzones expirados
     $doc = new Zend_Search_Lucene_Document();
     $doc->addField(Zend_Search_Lucene_Field::UnIndexed('pk', $this->getId()));
     $doc->addField(Zend_Search_Lucene_Field::unStored('username', $this->getUsername(), 'utf-8'));
     $doc->addField(Zend_Search_Lucene_Field::unStored('name', $this->getName(), 'utf-8'));
     $doc->addField(Zend_Search_Lucene_Field::unStored('email', $this->getEmail(), 'utf-8'));
     $doc->addField(Zend_Search_Lucene_Field::unStored('domain', $this->getDomainName(), 'utf-8'));
     $doc->addField(Zend_Search_Lucene_Field::unStored('area', $this->getGcArea(), 'utf-8'));
     $doc->addField(Zend_Search_Lucene_Field::unStored('group', $this->getGcGroup(), 'utf-8'));
     $index->addDocument($doc);
     $index->commit();
 }
开发者ID:rafix,项目名称:gesCorreo,代码行数:19,代码来源:GcMailbox.php

示例6: _build

 /**
  * Add node to index
  *
  * @param Zoo_Content_Interface $item
  */
 protected function _build(Zoo_Content_Interface $item)
 {
     // Delete existing document, if exists
     $hits = $this->index->find('nid:' . $item->id);
     foreach ($hits as $hit) {
         $this->index->delete($hit->id);
     }
     // (Re-)Index document
     $doc = new Zend_Search_Lucene_Document();
     $doc->addField(Zend_Search_Lucene_Field::text('nid', $item->id));
     $doc->addField(Zend_Search_Lucene_Field::unIndexed('link', $item->url()));
     $doc->addField(Zend_Search_Lucene_Field::unStored('title', $item->title));
     $doc->addField(Zend_Search_Lucene_Field::unStored('type', $item->type));
     $doc->addField(Zend_Search_Lucene_Field::unStored('published', $item->published));
     $doc->addField(Zend_Search_Lucene_Field::unStored('uid', $item->uid));
     list($content) = Zoo::getService('content')->getRenderedContent($item->id, 'Display');
     $doc->addField(Zend_Search_Lucene_Field::unStored('contents', strip_tags($content)));
     return $doc;
 }
开发者ID:BGCX261,项目名称:zoocms-svn-to-git,代码行数:24,代码来源:Lucene.php

示例7: index

 /**
  * php index.php db index
  *
  */
 public function index()
 {
     $query = "SELECT * FROM Products AS p JOIN Categories AS c ON p.CategoryID = c.CategoryId JOIN Suppliers AS s ON p.SupplierID = s.SupplierID";
     $stmt = $this->db->prepare($query);
     $stmt->execute();
     $rows = $stmt->fetchAll(PDO::FETCH_ASSOC);
     $indexDir = APP_PATH . '/' . self::INDEX_DIR;
     is_dir($indexDir) || mkdir($indexDir, 0777, true);
     $index = self::create($indexDir);
     foreach ($rows as $row) {
         $doc = new Zend_Search_Lucene_Document();
         $doc->addField(Zend_Search_Lucene_Field::keyword('ProductName', $row['ProductName']));
         $doc->addField(Zend_Search_Lucene_Field::text('Quantity', $row['QuantityPerUnit']));
         $doc->addField(Zend_Search_Lucene_Field::keyword('Category', $row['CategoryName']));
         $doc->addField(Zend_Search_Lucene_Field::unIndexed('Description', $row['Description']));
         $doc->addField(Zend_Search_Lucene_Field::unStored('City', $row['City']));
         $doc->addField(Zend_Search_Lucene_Field::keyword('CompanyName', $row['CompanyName']));
         $doc->addField(Zend_Search_Lucene_Field::binary('Picture', $row['Picture']));
         $index->addDocument($doc);
     }
 }
开发者ID:uniqid,项目名称:lucene,代码行数:25,代码来源:IndexDb.php

示例8: index

 /**
  * Index a field
  *
  * @param string  $name   the field name
  * @param mixed   $value  the field value
  * @param float   $boost  the boost value
  *
  * @return dmSearchDocument the search_document instance
  */
 protected function index($name, $value, $boost = 1.0)
 {
     $field = Zend_Search_Lucene_Field::unStored($name, $value);
     $field->boost = $boost;
     $this->addField($field);
 }
开发者ID:runopencode,项目名称:diem-extended,代码行数:15,代码来源:dmSearchPageDocument.php

示例9: indexFieldNow

 /**
  * indexFieldNow
  * @param GenericElementField $objField
  * @param string $strField
  * @param integer $intFieldType
  * @param string|array|object $mixedFieldValue
  * @param Zend_Search_Lucene_Document $objDoc
  * @return void
  * @author Thomas Schedler <tsh@massiveart.com>
  */
 protected final function indexFieldNow($objField, $strField, $intFieldType, $mixedFieldValue, Zend_Search_Lucene_Document &$objDoc)
 {
     try {
         $strValue = '';
         $strValueIds = '';
         if ($objField->typeId == GenericSetup::FIELD_TYPE_ID_TAG) {
             $mixedValue = $mixedFieldValue;
             if (is_object($mixedValue) || is_array($mixedValue)) {
                 foreach ($mixedValue as $objTag) {
                     $strValue .= $objTag->title . ', ';
                     $strValueIds .= '[' . $objTag->id . ']';
                 }
                 $strValue = rtrim($strValue, ', ');
             }
         } elseif (!is_object($mixedFieldValue) && $objField->sqlSelect != '') {
             $sqlSelect = $objField->sqlSelect;
             $arrIds = array();
             if (is_array($mixedFieldValue)) {
                 $arrIds = $mixedFieldValue;
             } else {
                 if ($mixedFieldValue != '') {
                     if (strpos($mixedFieldValue, '[') !== false) {
                         $mixedFieldValue = trim($mixedFieldValue, '[]');
                         $arrIds = explode('][', $mixedFieldValue);
                     } else {
                         $arrIds = array($mixedFieldValue);
                     }
                 }
             }
             if (is_array($arrIds)) {
                 if (count($arrIds) > 0) {
                     $strReplaceWhere = '';
                     foreach ($arrIds as $strId) {
                         $strReplaceWhere .= $strId . ',';
                     }
                     $strReplaceWhere = trim($strReplaceWhere, ',');
                     $objReplacer = new Replacer();
                     $sqlSelect = $objReplacer->sqlReplacer($sqlSelect, $this->setup->getLanguageId(), $this->setup->getRootLevelId(), ' AND tbl.id IN (' . $strReplaceWhere . ')');
                     $objCategoriesData = $this->core->dbh->query($sqlSelect)->fetchAll(Zend_Db::FETCH_OBJ);
                     if (count($objCategoriesData) > 0) {
                         foreach ($objCategoriesData as $objCategories) {
                             $strValue .= $objCategories->title . ', ';
                             $strValueIds .= '[' . $objCategories->id . ']';
                         }
                         $strValue = rtrim($strValue, ', ');
                     }
                 }
             }
         } else {
             $strValue = html_entity_decode($mixedFieldValue, ENT_COMPAT, $this->core->sysConfig->encoding->default);
         }
         if (is_string($strValue) && $strValue != '') {
             if ($intFieldType == GenericSetup::FILE_FIELD) {
                 $objFiles = $this->getModelFiles()->loadFilesById($strValue);
                 $arrValues = array();
                 if (count($objFiles) > 0) {
                     foreach ($objFiles as $objFile) {
                         $arrValues[] = array('path' => $objFile->path, 'filename' => $objFile->filename, 'version' => $objFile->version);
                     }
                 }
                 $strValueIds = $strValue;
                 $strValue = serialize($arrValues);
             }
             if ($strValueIds != '') {
                 $objDoc->addField(Zend_Search_Lucene_Field::unIndexed($strField . 'Ids', $strValueIds, $this->core->sysConfig->encoding->default));
             }
             $this->core->logger->debug($strField . ': ' . $strValue);
             switch ($objField->idSearchFieldTypes) {
                 case Search::FIELD_TYPE_KEYWORD:
                     $objDoc->addField(Zend_Search_Lucene_Field::keyword($strField, $strValue, $this->core->sysConfig->encoding->default));
                     break;
                 case Search::FIELD_TYPE_UNINDEXED:
                     $objDoc->addField(Zend_Search_Lucene_Field::unIndexed($strField, $strValue, $this->core->sysConfig->encoding->default));
                     break;
                 case Search::FIELD_TYPE_BINARY:
                     $objDoc->addField(Zend_Search_Lucene_Field::binary($strField, $strValue, $this->core->sysConfig->encoding->default));
                     break;
                 case Search::FIELD_TYPE_TEXT:
                     $objDoc->addField(Zend_Search_Lucene_Field::text($strField, $strValue, $this->core->sysConfig->encoding->default));
                     break;
                 case Search::FIELD_TYPE_UNSTORED:
                     $objDoc->addField(Zend_Search_Lucene_Field::unStored($strField, strip_tags($strValue), $this->core->sysConfig->encoding->default));
                     break;
             }
         }
     } catch (Exception $exc) {
         $this->core->logger->err($exc);
     }
 }
开发者ID:BGCX261,项目名称:zoolu-svn-to-git,代码行数:99,代码来源:generic.data.type.abstract.class.php

示例10: addToIndex

 /**
  * addToIndex
  * @param string $strIndexPath
  * @param string $strKey
  * @author Thomas Schedler <tsh@massiveart.com>
  * @version 1.0
  */
 protected final function addToIndex($strIndexPath, $strKey)
 {
     try {
         if (!is_object($this->objIndex) || !$this->objIndex instanceof Zend_Search_Lucene) {
             if (count(scandir($strIndexPath)) > 2) {
                 $this->objIndex = Zend_Search_Lucene::open($strIndexPath);
             } else {
                 $this->objIndex = Zend_Search_Lucene::create($strIndexPath);
             }
         }
         $objDoc = new Zend_Search_Lucene_Document();
         $objDoc->addField(Zend_Search_Lucene_Field::keyword('key', $strKey));
         $objDoc->addField(Zend_Search_Lucene_Field::unIndexed('date', $this->setup->getPublishDate('d.m.Y')));
         $objDoc->addField(Zend_Search_Lucene_Field::unIndexed('rootLevelId', $this->setup->getRootLevelId()));
         /**
          * index fields
          */
         foreach ($this->setup->FieldNames() as $strField => $intFieldType) {
             $objField = $this->setup->getField($strField);
             if (is_object($objField) && $objField->idSearchFieldTypes != Search::FIELD_TYPE_NONE) {
                 $strValue = '';
                 if (is_array($objField->getValue()) && $objField->sqlSelect != '') {
                     $arrIds = $objField->getValue();
                     $sqlSelect = $objField->sqlSelect;
                     if (is_array($arrIds)) {
                         if (count($arrIds) > 0) {
                             $strReplaceWhere = '';
                             foreach ($arrIds as $strId) {
                                 $strReplaceWhere .= $strId . ',';
                             }
                             $strReplaceWhere = trim($strReplaceWhere, ',');
                             $objReplacer = new Replacer();
                             $sqlSelect = $objReplacer->sqlReplacer($sqlSelect, $this->setup->getLanguageId(), $this->setup->getRootLevelId(), ' AND tbl.id IN (' . $strReplaceWhere . ')');
                             $objCategoriesData = $this->core->dbh->query($sqlSelect)->fetchAll(Zend_Db::FETCH_OBJ);
                             if (count($objCategoriesData) > 0) {
                                 foreach ($objCategoriesData as $objCategories) {
                                     $strValue .= $objCategories->title . ', ';
                                 }
                                 $strValue = rtrim($strValue, ', ');
                             }
                         }
                     }
                 } else {
                     $strValue = $objField->getValue();
                 }
                 if ($strValue != '') {
                     switch ($objField->idSearchFieldTypes) {
                         case Search::FIELD_TYPE_KEYWORD:
                             $objDoc->addField(Zend_Search_Lucene_Field::keyword($strField, $strValue, $this->core->sysConfig->encoding->default));
                             break;
                         case Search::FIELD_TYPE_UNINDEXED:
                             $objDoc->addField(Zend_Search_Lucene_Field::unIndexed($strField, $strValue, $this->core->sysConfig->encoding->default));
                             break;
                         case Search::FIELD_TYPE_BINARY:
                             $objDoc->addField(Zend_Search_Lucene_Field::binary($strField, $strValue, $this->core->sysConfig->encoding->default));
                             break;
                         case Search::FIELD_TYPE_TEXT:
                             $objDoc->addField(Zend_Search_Lucene_Field::text($strField, $strValue, $this->core->sysConfig->encoding->default));
                             break;
                         case Search::FIELD_TYPE_UNSTORED:
                             $objDoc->addField(Zend_Search_Lucene_Field::unStored($strField, strip_tags($strValue), $this->core->sysConfig->encoding->default));
                             break;
                     }
                 }
             }
         }
         // Add document to the index.
         $this->objIndex->addDocument($objDoc);
         $this->objIndex->optimize();
     } catch (Exception $exc) {
         $this->core->logger->err($exc);
     }
 }
开发者ID:BGCX261,项目名称:zoolu-svn-to-git,代码行数:80,代码来源:generic.data.type.abstract.class.php

示例11: updateLuceneIndex

 /**
  * @ORM\PostPersist
  */
 public function updateLuceneIndex()
 {
     $index = self::getLuceneIndex();
     //remove existing entries
     foreach ($index->find('pk:' . $this->getId()) as $hit) {
         $index->delete($hit->id);
     }
     if ($this->isExpired() || !$this->getIsActivated()) {
         return;
     }
     $doc = new \Zend_Search_Lucene_Document();
     $doc->addField(\Zend_Search_Lucene_Field::keyword('pk', $this->getId()));
     //index job fields
     $doc->addField(\Zend_Search_Lucene_Field::unStored('position', $this->getPosition(), 'utf-8'));
     $doc->addField(\Zend_Search_Lucene_Field::unStored('company', $this->getCompany(), 'utf-8'));
     $doc->addField(\Zend_Search_Lucene_Field::unStored('location', $this->getLocation(), 'utf-8'));
     $doc->addField(\Zend_Search_Lucene_Field::unStored('description', $this->getDescription(), 'utf-8'));
     $index->addDocument($doc);
     $index->commit();
 }
开发者ID:rikon,项目名称:jobeet,代码行数:23,代码来源:Job.php

示例12: addDocument

 /**
  * A refactored method to add the document to the index..
  *
  * @param int $docid
  * @param string $content
  * @param string $discussion
  */
 private function addDocument($docid, $content, $discussion, $title, $version)
 {
     $teaser = substr($content, 0, 250);
     $doc = new Zend_Search_Lucene_Document();
     $doc->addField(Zend_Search_Lucene_Field::Text('DocumentID', PHPLuceneIndexer::longToString($docid)));
     $doc->addField(Zend_Search_Lucene_Field::Text('Content', $content, 'UTF-8'));
     $doc->addField(Zend_Search_Lucene_Field::unStored('Discussion', $discussion, 'UTF-8'));
     $doc->addField(Zend_Search_Lucene_Field::Text('Title', $title, 'UTF-8'));
     $doc->addField(Zend_Search_Lucene_Field::Text('Version', $version, 'UTF-8'));
     $doc->addField(Zend_Search_Lucene_Field::unIndexed('Summary', $teaser, 'UTF-8'));
     $this->lucene->addDocument($doc);
 }
开发者ID:5haman,项目名称:knowledgetree,代码行数:19,代码来源:PHPLuceneIndexer.inc.php

示例13: normalizeMap

 /**
  *  converts the map into a document so Lucene can save it
  *
  *  @param  MingoTable  $table
  *  @param  array $map  the raw map passed to {@link insert()} or {@link update()}      
  *  @return Zend_Search_Lucene_Document
  */
 protected function normalizeMap(MingoTable $table, array $map)
 {
     $document = new Zend_Search_Lucene_Document();
     // add some fields that will be present in all documents...
     $document->addField(Zend_Search_Lucene_Field::unStored('_id', $map['_id']));
     $document->addField(Zend_Search_Lucene_Field::binary('body', $this->getBody($map)));
     // add all the indexes into the document...
     foreach ($table->getIndexes() as $index) {
         foreach ($index->getFields() as $name => $options) {
             // use array_key... to account for null values...
             if (array_key_exists($name, $map)) {
                 $val = null;
                 if (is_array($map[$name])) {
                     $val = join(' ', $map[$name]);
                 } else {
                     $val = $map[$name];
                 }
                 //if/else
                 $document->addField(Zend_Search_Lucene_Field::UnStored($name, $val));
                 // let's not try and add it twice...
                 unset($map[$name]);
             }
             //if
         }
         //foreach
     }
     //foreach
     return $document;
 }
开发者ID:Jaymon,项目名称:Mingo,代码行数:36,代码来源:MingoLuceneInterface.php

示例14: 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

示例15: createIndexedDocument

 /**
  * @param AJXP_Node $ajxpNode
  * @param Zend_Search_Lucene_Interface $index
  * @throws Exception
  * @return Zend_Search_Lucene_Document
  */
 public function createIndexedDocument($ajxpNode, &$index)
 {
     $ajxpNode->loadNodeInfo();
     $ext = strtolower(pathinfo($ajxpNode->getLabel(), PATHINFO_EXTENSION));
     $parseContent = $this->indexContent;
     if ($parseContent && $ajxpNode->bytesize > $this->getFilteredOption("PARSE_CONTENT_MAX_SIZE")) {
         $parseContent = false;
     }
     if ($parseContent && in_array($ext, explode(",", $this->getFilteredOption("PARSE_CONTENT_HTML")))) {
         $doc = @Zend_Search_Lucene_Document_Html::loadHTMLFile($ajxpNode->getUrl());
     } elseif ($parseContent && $ext == "docx" && class_exists("Zend_Search_Lucene_Document_Docx")) {
         $realFile = call_user_func(array($ajxpNode->wrapperClassName, "getRealFSReference"), $ajxpNode->getUrl());
         $doc = @Zend_Search_Lucene_Document_Docx::loadDocxFile($realFile);
     } elseif ($parseContent && $ext == "docx" && class_exists("Zend_Search_Lucene_Document_Pptx")) {
         $realFile = call_user_func(array($ajxpNode->wrapperClassName, "getRealFSReference"), $ajxpNode->getUrl());
         $doc = @Zend_Search_Lucene_Document_Pptx::loadPptxFile($realFile);
     } elseif ($parseContent && $ext == "xlsx" && class_exists("Zend_Search_Lucene_Document_Xlsx")) {
         $realFile = call_user_func(array($ajxpNode->wrapperClassName, "getRealFSReference"), $ajxpNode->getUrl());
         $doc = @Zend_Search_Lucene_Document_Xlsx::loadXlsxFile($realFile);
     } else {
         $doc = new Zend_Search_Lucene_Document();
     }
     if ($doc == null) {
         throw new Exception("Could not load document");
     }
     $doc->addField(Zend_Search_Lucene_Field::Keyword("node_url", $ajxpNode->getUrl()), SystemTextEncoding::getEncoding());
     $doc->addField(Zend_Search_Lucene_Field::Keyword("node_path", str_replace("/", "AJXPFAKESEP", $ajxpNode->getPath())), SystemTextEncoding::getEncoding());
     $doc->addField(Zend_Search_Lucene_Field::Text("basename", basename($ajxpNode->getPath())), SystemTextEncoding::getEncoding());
     $doc->addField(Zend_Search_Lucene_Field::Keyword("ajxp_node", "yes"), SystemTextEncoding::getEncoding());
     $doc->addField(Zend_Search_Lucene_Field::Keyword("ajxp_scope", "shared"));
     $doc->addField(Zend_Search_Lucene_Field::Keyword("ajxp_modiftime", date("Ymd", $ajxpNode->ajxp_modiftime)));
     $doc->addField(Zend_Search_Lucene_Field::Keyword("ajxp_bytesize", $ajxpNode->bytesize));
     $ajxpMime = $ajxpNode->ajxp_mime;
     if (empty($ajxpMime)) {
         $doc->addField(Zend_Search_Lucene_Field::Keyword("ajxp_mime", pathinfo($ajxpNode->getLabel(), PATHINFO_EXTENSION)));
     } else {
         $doc->addField(Zend_Search_Lucene_Field::Keyword("ajxp_mime", $ajxpNode->ajxp_mime));
     }
     // Store a cached copy of the metadata
     $serializedMeta = base64_encode(serialize($ajxpNode->metadata));
     $doc->addField(Zend_Search_Lucene_Field::Binary("serialized_metadata", $serializedMeta));
     if (isset($ajxpNode->indexableMetaKeys["shared"])) {
         foreach ($ajxpNode->indexableMetaKeys["shared"] as $sharedField) {
             if ($ajxpNode->{$sharedField}) {
                 $doc->addField(Zend_search_Lucene_Field::keyword($sharedField, $ajxpNode->{$sharedField}));
             }
         }
     }
     foreach ($this->metaFields as $field) {
         if ($ajxpNode->{$field} != null) {
             $doc->addField(Zend_Search_Lucene_Field::Text("ajxp_meta_{$field}", $ajxpNode->{$field}), SystemTextEncoding::getEncoding());
         }
     }
     if (isset($ajxpNode->indexableMetaKeys["user"]) && count($ajxpNode->indexableMetaKeys["user"]) && AuthService::usersEnabled() && AuthService::getLoggedUser() != null) {
         $privateDoc = new Zend_Search_Lucene_Document();
         $privateDoc->addField(Zend_Search_Lucene_Field::Keyword("node_url", $ajxpNode->getUrl(), SystemTextEncoding::getEncoding()));
         $privateDoc->addField(Zend_Search_Lucene_Field::Keyword("node_path", str_replace("/", "AJXPFAKESEP", $ajxpNode->getPath()), SystemTextEncoding::getEncoding()));
         $privateDoc->addField(Zend_Search_Lucene_Field::Keyword("ajxp_scope", "user"));
         $privateDoc->addField(Zend_Search_Lucene_Field::Keyword("ajxp_user", AuthService::getLoggedUser()->getId()));
         foreach ($ajxpNode->indexableMetaKeys["user"] as $userField) {
             if ($ajxpNode->{$userField}) {
                 $privateDoc->addField(Zend_search_Lucene_Field::keyword($userField, $ajxpNode->{$userField}));
             }
         }
         $privateDoc->addField(Zend_Search_Lucene_Field::Binary("serialized_metadata", $serializedMeta));
         $index->addDocument($privateDoc);
     }
     if ($parseContent && in_array($ext, explode(",", $this->getFilteredOption("PARSE_CONTENT_TXT")))) {
         $doc->addField(Zend_Search_Lucene_Field::unStored("body", file_get_contents($ajxpNode->getUrl())));
     }
     $unoconv = $this->getFilteredOption("UNOCONV");
     $pipe = false;
     if ($parseContent && !empty($unoconv) && in_array($ext, array("doc", "odt", "xls", "ods"))) {
         $targetExt = "txt";
         if (in_array($ext, array("xls", "ods"))) {
             $targetExt = "csv";
         } else {
             if (in_array($ext, array("odp", "ppt"))) {
                 $targetExt = "pdf";
                 $pipe = true;
             }
         }
         $realFile = call_user_func(array($ajxpNode->wrapperClassName, "getRealFSReference"), $ajxpNode->getUrl());
         $unoconv = "HOME=" . AJXP_Utils::getAjxpTmpDir() . " " . $unoconv . " --stdout -f {$targetExt} " . escapeshellarg($realFile);
         if ($pipe) {
             $newTarget = str_replace(".{$ext}", ".pdf", $realFile);
             $unoconv .= " > {$newTarget}";
             register_shutdown_function("unlink", $newTarget);
         }
         $output = array();
         exec($unoconv, $output, $return);
         if (!$pipe) {
             $out = implode("\n", $output);
             $enc = 'ISO-8859-1';
//.........这里部分代码省略.........
开发者ID:projectesIF,项目名称:Ateneu,代码行数:101,代码来源:class.AjxpLuceneIndexer.php


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