Example #1
0
 /**
  * Constructs an initializes a Weight for a query.
  *
  * @param Zend_Search_Lucene $reader
  */
 protected function _initWeight($reader)
 {
     $this->_weight = $this->_createWeight($reader);
     $sum = $this->_weight->sumOfSquaredWeights();
     $queryNorm = $reader->getSimilarity()->queryNorm($sum);
     $this->_weight->normalize($queryNorm);
 }
Example #2
0
 /**
  * Constructs an initializes a Weight for a _top-level_query_.
  *
  * @param Zend_Search_Lucene_Interface $reader
  */
 protected function _initWeight(Zend_Search_Lucene_Interface $reader)
 {
     // Check, that it's a top-level query and query weight is not initialized yet.
     if ($this->_weight !== null) {
         return $this->_weight;
     }
     $this->createWeight($reader);
     $sum = $this->_weight->sumOfSquaredWeights();
     $queryNorm = $reader->getSimilarity()->queryNorm($sum);
     $this->_weight->normalize($queryNorm);
 }