[ Index ]
 

Code source de PRADO 3.0.6

Accédez au Source d'autres logiciels libresSoutenez Angelica Josefina !

title

Body

[fermer]

/demos/quickstart/protected/index/Zend/Search/Lucene/Search/ -> Query.php (source)

   1  <?php
   2  /**
   3   * Zend Framework
   4   *
   5   * LICENSE
   6   *
   7   * This source file is subject to version 1.0 of the Zend Framework
   8   * license, that is bundled with this package in the file LICENSE, and
   9   * is available through the world-wide-web at the following URL:
  10   * http://www.zend.com/license/framework/1_0.txt. If you did not receive
  11   * a copy of the Zend Framework license and are unable to obtain it
  12   * through the world-wide-web, please send a note to license@zend.com
  13   * so we can mail you a copy immediately.
  14   *
  15   * @package    Zend_Search_Lucene
  16   * @subpackage Search
  17   * @copyright  Copyright (c) 2005-2006 Zend Technologies USA Inc. (http://www.zend.com)
  18   * @license    http://www.zend.com/license/framework/1_0.txt Zend Framework License version 1.0
  19   */
  20  
  21  
  22  /**
  23   * @package    Zend_Search_Lucene
  24   * @subpackage Search
  25   * @copyright  Copyright (c) 2005-2006 Zend Technologies USA Inc. (http://www.zend.com)
  26   * @license    http://www.zend.com/license/framework/1_0.txt Zend Framework License version 1.0
  27   */
  28  abstract class Zend_Search_Lucene_Search_Query
  29  {
  30  
  31      /**
  32       * query boost factor
  33       *
  34       * @var float
  35       */
  36      private $_boost = 1.0;
  37  
  38      /**
  39       * Query weight
  40       *
  41       * @var Zend_Search_Lucene_Search_Weight
  42       */
  43      protected $_weight;
  44  
  45  
  46      /**
  47       * Gets the boost for this clause.  Documents matching
  48       * this clause will (in addition to the normal weightings) have their score
  49       * multiplied by boost.   The boost is 1.0 by default.
  50       *
  51       * @return float
  52       */
  53      public function getBoost()
  54      {
  55          return $this->_boost;
  56      }
  57  
  58      /**
  59       * Sets the boost for this query clause to $boost.
  60       *
  61       * @param float $boost
  62       */
  63      public function setBoost($boost)
  64      {
  65          $this->_boost = $boost;
  66      }
  67  
  68      /**
  69       * Score specified document
  70       *
  71       * @param integer $docId
  72       * @param Zend_Search_Lucene $reader
  73       * @return float
  74       */
  75      abstract public function score($docId, $reader);
  76  
  77      /**
  78       * Constructs an appropriate Weight implementation for this query.
  79       *
  80       * @param Zend_Search_Lucene $reader
  81       * @return Zend_Search_Lucene_Search_Weight
  82       */
  83      abstract protected function _createWeight($reader);
  84  
  85      /**
  86       * Constructs an initializes a Weight for a query.
  87       *
  88       * @param Zend_Search_Lucene $reader
  89       */
  90      protected function _initWeight($reader)
  91      {
  92          $this->_weight = $this->_createWeight($reader);
  93          $sum = $this->_weight->sumOfSquaredWeights();
  94          $queryNorm = $reader->getSimilarity()->queryNorm($sum);
  95          $this->_weight->normalize($queryNorm);
  96      }
  97  
  98  }


Généré le : Sun Feb 25 21:07:04 2007 par Balluche grâce à PHPXref 0.7