[ Index ]

PHP Cross Reference of Moodle 1.9.3 [Build 15-Oct-2008]

title

Body

[close]

/search/Zend/Search/Lucene/Search/Query/ -> Empty.php (source)

   1  <?php
   2  /**
   3   * Zend Framework
   4   *
   5   * LICENSE
   6   *
   7   * This source file is subject to the new BSD license that is bundled
   8   * with this package in the file LICENSE.txt.
   9   * It is also available through the world-wide-web at this URL:
  10   * http://framework.zend.com/license/new-bsd
  11   * If you did not receive a copy of the license and are unable to
  12   * obtain it through the world-wide-web, please send an email
  13   * to license@zend.com so we can send you a copy immediately.
  14   *
  15   * @category   Zend
  16   * @package    Zend_Search_Lucene
  17   * @subpackage Search
  18   * @copyright  Copyright (c) 2005-2007 Zend Technologies USA Inc. (http://www.zend.com)
  19   * @license    http://framework.zend.com/license/new-bsd     New BSD License
  20   */
  21  
  22  
  23  /** Zend_Search_Lucene_Search_Query */
  24  require_once $CFG->dirroot.'/search/Zend/Search/Lucene/Search/Query.php';
  25  
  26  /** Zend_Search_Lucene_Search_Weight_Empty */
  27  require_once $CFG->dirroot.'/search/Zend/Search/Lucene/Search/Weight/Empty.php';
  28  
  29  
  30  /**
  31   * @category   Zend
  32   * @package    Zend_Search_Lucene
  33   * @subpackage Search
  34   * @copyright  Copyright (c) 2005-2007 Zend Technologies USA Inc. (http://www.zend.com)
  35   * @license    http://framework.zend.com/license/new-bsd     New BSD License
  36   */
  37  class Zend_Search_Lucene_Search_Query_Empty extends Zend_Search_Lucene_Search_Query
  38  {
  39      /**
  40       * Re-write query into primitive queries in the context of specified index
  41       *
  42       * @param Zend_Search_Lucene_Interface $index
  43       * @return Zend_Search_Lucene_Search_Query
  44       */
  45      public function rewrite(Zend_Search_Lucene_Interface $index)
  46      {
  47          return $this;
  48      }
  49  
  50      /**
  51       * Optimize query in the context of specified index
  52       *
  53       * @param Zend_Search_Lucene_Interface $index
  54       * @return Zend_Search_Lucene_Search_Query
  55       */
  56      public function optimize(Zend_Search_Lucene_Interface $index)
  57      {
  58          // "Empty" query is a primitive query and don't need to be optimized
  59          return $this;
  60      }
  61  
  62      /**
  63       * Constructs an appropriate Weight implementation for this query.
  64       *
  65       * @param Zend_Search_Lucene_Interface $reader
  66       * @return Zend_Search_Lucene_Search_Weight
  67       */
  68      public function createWeight(Zend_Search_Lucene_Interface $reader)
  69      {
  70          return new Zend_Search_Lucene_Search_Weight_Empty();
  71      }
  72  
  73      /**
  74       * Execute query in context of index reader
  75       * It also initializes necessary internal structures
  76       *
  77       * @param Zend_Search_Lucene_Interface $reader
  78       */
  79      public function execute(Zend_Search_Lucene_Interface $reader)
  80      {
  81          // Do nothing
  82      }
  83  
  84      /**
  85       * Get document ids likely matching the query
  86       *
  87       * It's an array with document ids as keys (performance considerations)
  88       *
  89       * @return array
  90       */
  91      public function matchedDocs()
  92      {
  93          return array();
  94      }
  95  
  96      /**
  97       * Score specified document
  98       *
  99       * @param integer $docId
 100       * @param Zend_Search_Lucene_Interface $reader
 101       * @return float
 102       */
 103      public function score($docId, Zend_Search_Lucene_Interface $reader)
 104      {
 105          return 0;
 106      }
 107  
 108      /**
 109       * Return query terms
 110       *
 111       * @return array
 112       */
 113      public function getQueryTerms()
 114      {
 115          return array();
 116      }
 117  
 118      /**
 119       * Highlight query terms
 120       *
 121       * @param integer &$colorIndex
 122       * @param Zend_Search_Lucene_Document_Html $doc
 123       */
 124      public function highlightMatchesDOM(Zend_Search_Lucene_Document_Html $doc, &$colorIndex)
 125      {
 126          // Do nothing
 127      }
 128  
 129      /**
 130       * Print a query
 131       *
 132       * @return string
 133       */
 134      public function __toString()
 135      {
 136          return '<EmptyQuery>';
 137      }
 138  }
 139  


Generated: Wed Jan 14 11:33:29 2009 Cross-referenced by PHPXref 0.7