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


PHP Zend_Search_Lucene_Interface::termDocs方法代碼示例

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


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

示例1: execute

 public function execute(Zend_Search_Lucene_Interface $reader, $docsFilter = null)
 {
     $this->_docVector = array_flip($reader->termDocs($this->_term, $docsFilter));
     $this->_termFreqs = $reader->termFreqs($this->_term, $docsFilter);
     // Initialize weight if it's not done yet
     $this->_initWeight($reader);
 }
開發者ID:hackingman,項目名稱:TubeX,代碼行數:7,代碼來源:Term.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: getDocumentIds

 /**
  * Get the Lucene document IDs by search the specified search field.
  * If no search field is specified, the default ID field is used.
  *
  * @param string $value
  * @param string $searchField
  * @return array
  */
 public function getDocumentIds($value, $searchField = null)
 {
     if (!$searchField) {
         $searchField = $this->_idKey;
     }
     $term = new Zend_Search_Lucene_Index_Term($value, $searchField);
     $docIds = $this->_searchIndex->termDocs($term);
     return $docIds;
 }
開發者ID:BGCX262,項目名稱:zym-svn-to-git,代碼行數:17,代碼來源:Index.php

示例4: _calculateNonConjunctionResult

 /**
  * Calculate result vector for non Conjunction query
  * (like '+something -another')
  *
  * @param Zend_Search_Lucene_Interface $reader
  */
 private function _calculateNonConjunctionResult(Zend_Search_Lucene_Interface $reader)
 {
     $requiredVectors = array();
     $requiredVectorsSizes = array();
     $requiredVectorsIds = array();
     // is used to prevent arrays comparison
     $optional = array();
     $prohibited = array();
     foreach ($this->_terms as $termId => $term) {
         $termDocs = array_flip($reader->termDocs($term));
         if ($this->_signs[$termId] === true) {
             // required
             $requiredVectors[] = $termDocs;
             $requiredVectorsSizes[] = count($termDocs);
             $requiredVectorsIds[] = $termId;
         } elseif ($this->_signs[$termId] === false) {
             // prohibited
             // array union
             $prohibited += $termDocs;
         } else {
             // neither required, nor prohibited
             // array union
             $optional += $termDocs;
         }
         $this->_termsFreqs[$termId] = $reader->termFreqs($term);
     }
     // sort resvectors in order of subquery cardinality increasing
     array_multisort($requiredVectorsSizes, SORT_ASC, SORT_NUMERIC, $requiredVectorsIds, SORT_ASC, SORT_NUMERIC, $requiredVectors);
     $required = null;
     foreach ($requiredVectors as $nextResVector) {
         if ($required === null) {
             $required = $nextResVector;
         } else {
             //$required = array_intersect_key($required, $nextResVector);
             /**
              * This code is used as workaround for array_intersect_key() slowness problem.
              */
             $updatedVector = array();
             foreach ($required as $id => $value) {
                 if (isset($nextResVector[$id])) {
                     $updatedVector[$id] = $value;
                 }
             }
             $required = $updatedVector;
         }
         if (count($required) == 0) {
             // Empty result set, we don't need to check other terms
             break;
         }
     }
     if ($required !== null) {
         $this->_resVector = $required;
     } else {
         $this->_resVector = $optional;
     }
     if (count($prohibited) != 0) {
         // $this->_resVector = array_diff_key($this->_resVector, $prohibited);
         /**
          * This code is used as workaround for array_diff_key() slowness problem.
          */
         if (count($this->_resVector) < count($prohibited)) {
             $updatedVector = $this->_resVector;
             foreach ($this->_resVector as $id => $value) {
                 if (isset($prohibited[$id])) {
                     unset($updatedVector[$id]);
                 }
             }
             $this->_resVector = $updatedVector;
         } else {
             $updatedVector = $this->_resVector;
             foreach ($prohibited as $id => $value) {
                 unset($updatedVector[$id]);
             }
             $this->_resVector = $updatedVector;
         }
     }
     ksort($this->_resVector, SORT_NUMERIC);
 }
開發者ID:sraj4,項目名稱:EthicsPublicHtmlProd,代碼行數:84,代碼來源:MultiTerm.php

示例5: termDocs

 /**
  * Returns IDs of all the documents containing term.
  *
  * @param Zend_Search_Lucene_Index_Term $term
  * @param Zend_Search_Lucene_Index_DocsFilter|null $docsFilter
  * @return array
  */
 public function termDocs(Zend_Search_Lucene_Index_Term $term, $docsFilter = null)
 {
     return $this->_index->termDocs($term, $docsFilter);
 }
開發者ID:abdulhadikaryana,項目名稱:kebudayaan,代碼行數:11,代碼來源:Proxy.php

示例6: execute

 /**
  * Execute query in context of index reader
  * It also initializes necessary internal structures
  *
  * @param Zend_Search_Lucene_Interface $reader
  * @param Zend_Search_Lucene_Index_DocsFilter|null $docsFilter
  */
 public function execute(Zend_Search_Lucene_Interface $reader, $docsFilter = null)
 {
     $this->_resVector = null;
     if (count($this->_terms) == 0) {
         $this->_resVector = array();
     }
     $resVectors = array();
     $resVectorsSizes = array();
     $resVectorsIds = array();
     // is used to prevent arrays comparison
     foreach ($this->_terms as $termId => $term) {
         $resVectors[] = array_flip($reader->termDocs($term));
         $resVectorsSizes[] = count(end($resVectors));
         $resVectorsIds[] = $termId;
         $this->_termsPositions[$termId] = $reader->termPositions($term);
     }
     // sort resvectors in order of subquery cardinality increasing
     array_multisort($resVectorsSizes, SORT_ASC, SORT_NUMERIC, $resVectorsIds, SORT_ASC, SORT_NUMERIC, $resVectors);
     foreach ($resVectors as $nextResVector) {
         if ($this->_resVector === null) {
             $this->_resVector = $nextResVector;
         } else {
             //$this->_resVector = array_intersect_key($this->_resVector, $nextResVector);
             /**
              * This code is used as workaround for array_intersect_key() slowness problem.
              */
             $updatedVector = array();
             foreach ($this->_resVector as $id => $value) {
                 if (isset($nextResVector[$id])) {
                     $updatedVector[$id] = $value;
                 }
             }
             $this->_resVector = $updatedVector;
         }
         if (count($this->_resVector) == 0) {
             // Empty result set, we don't need to check other terms
             break;
         }
     }
     // ksort($this->_resVector, SORT_NUMERIC);
     // Docs are returned ordered. Used algorithm doesn't change elements order.
     // Initialize weight if it's not done yet
     $this->_initWeight($reader);
 }
開發者ID:MexinaD,項目名稱:SuiteCRM,代碼行數:51,代碼來源:Phrase.php

示例7: termDocs

 /**
  * Returns IDs of all the documents containing term.
  *
  * @param Zend_Search_Lucene_Index_Term $term
  * @return array
  */
 public function termDocs(Zend_Search_Lucene_Index_Term $term)
 {
     return $this->_index->termDocs($term);
 }
開發者ID:lortnus,項目名稱:zf1,代碼行數:10,代碼來源:Proxy.php

示例8: getIndexedDocumentId

 /**
  * @param  Zend_Search_Lucene_Interface $index
  * @param AJXP_Node $ajxpNode
  * @return Number
  */
 public function getIndexedDocumentId($index, $ajxpNode)
 {
     $term = new Zend_Search_Lucene_Index_Term(SystemTextEncoding::toUTF8($ajxpNode->getUrl()), "node_url");
     $docIds = $index->termDocs($term);
     if (!count($docIds)) {
         return null;
     }
     return $docIds[0];
 }
開發者ID:thermalpaste,項目名稱:pydio-core,代碼行數:14,代碼來源:class.AjxpLuceneIndexer.php

示例9: _calculateNonConjunctionResult

 /**
  * Calculate result vector for non Conjunction query
  * (like '+something -another')
  *
  * @param Zend_Search_Lucene_Interface $reader
  */
 private function _calculateNonConjunctionResult(Zend_Search_Lucene_Interface $reader)
 {
     $required = null;
     $optional = array();
     $prohibited = array();
     foreach ($this->_terms as $termId => $term) {
         $termDocs = array_flip($reader->termDocs($term));
         if ($this->_signs[$termId] === true) {
             // required
             if ($required !== null) {
                 // array intersection
                 $required = array_intersect_key($required, $termDocs);
             } else {
                 $required = $termDocs;
             }
         } elseif ($this->_signs[$termId] === false) {
             // prohibited
             // array union
             $prohibited += $termDocs;
         } else {
             // neither required, nor prohibited
             // array union
             $optional += $termDocs;
         }
         $this->_termsFreqs[$termId] = $reader->termFreqs($term);
     }
     if ($required !== null) {
         $this->_resVector = count($prohibited) > 0 ? array_diff_key($required, $prohibited) : $required;
     } else {
         $this->_resVector = count($prohibited) > 0 ? array_diff_key($optional, $prohibited) : $optional;
     }
     ksort($this->_resVector, SORT_NUMERIC);
 }
開發者ID:vojtajina,項目名稱:sitellite,代碼行數:39,代碼來源:MultiTerm.php

示例10: execute

 /**
  * Execute query in context of index reader
  * It also initializes necessary internal structures
  *
  * @param Zend_Search_Lucene_Interface $reader
  */
 public function execute(Zend_Search_Lucene_Interface $reader)
 {
     $this->_resVector = null;
     if (count($this->_terms) == 0) {
         $this->_resVector = array();
     }
     foreach ($this->_terms as $termId => $term) {
         if ($this->_resVector === null) {
             $this->_resVector = array_flip($reader->termDocs($term));
         } else {
             $this->_resVector = array_intersect_key($this->_resVector, array_flip($reader->termDocs($term)));
         }
         if (count($this->_resVector) == 0) {
             // Empty result set, we don't need to check other terms
             break;
         }
         $this->_termsPositions[$termId] = $reader->termPositions($term);
     }
     ksort($this->_resVector, SORT_NUMERIC);
     // Initialize weight if it's not done yet
     $this->_initWeight($reader);
 }
開發者ID:vojtajina,項目名稱:sitellite,代碼行數:28,代碼來源:Phrase.php

示例11: execute

 public function execute(Zend_Search_Lucene_Interface $reader, $docsFilter = null)
 {
     $this->_resVector = null;
     if (count($this->_terms) == 0) {
         $this->_resVector = array();
     }
     $resVectors = array();
     $resVectorsSizes = array();
     $resVectorsIds = array();
     foreach ($this->_terms as $termId => $term) {
         $resVectors[] = array_flip($reader->termDocs($term));
         $resVectorsSizes[] = count(end($resVectors));
         $resVectorsIds[] = $termId;
         $this->_termsPositions[$termId] = $reader->termPositions($term);
     }
     array_multisort($resVectorsSizes, SORT_ASC, SORT_NUMERIC, $resVectorsIds, SORT_ASC, SORT_NUMERIC, $resVectors);
     foreach ($resVectors as $nextResVector) {
         if ($this->_resVector === null) {
             $this->_resVector = $nextResVector;
         } else {
             $updatedVector = array();
             foreach ($this->_resVector as $id => $value) {
                 if (isset($nextResVector[$id])) {
                     $updatedVector[$id] = $value;
                 }
             }
             $this->_resVector = $updatedVector;
         }
         if (count($this->_resVector) == 0) {
             break;
         }
     }
     $this->_initWeight($reader);
 }
開發者ID:Blu2z,項目名稱:implsk,代碼行數:34,代碼來源:Zend_Search_Lucene.php


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