~chroot64bit/zivios/gentoo-experimental

« back to all changes in this revision

Viewing changes to application/library/Zend/Search/Lucene/Search/Weight.php

  • Committer: Mustafa A. Hashmi
  • Date: 2008-12-04 13:32:21 UTC
  • Revision ID: mhashmi@zivios.org-20081204133221-0nd1trunwevijj38
Inclusion of new installation framework with ties to zend layout and dojo layout

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
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-2008 Zend Technologies USA Inc. (http://www.zend.com)
 
19
 * @license    http://framework.zend.com/license/new-bsd     New BSD License
 
20
 */
 
21
 
 
22
 
 
23
/**
 
24
 * Calculate query weights and build query scorers.
 
25
 *
 
26
 * A Weight is constructed by a query Query->createWeight().
 
27
 * The sumOfSquaredWeights() method is then called on the top-level
 
28
 * query to compute the query normalization factor Similarity->queryNorm(float).
 
29
 * This factor is then passed to normalize(float).  At this point the weighting
 
30
 * is complete.
 
31
 *
 
32
 * @category   Zend
 
33
 * @package    Zend_Search_Lucene
 
34
 * @subpackage Search
 
35
 * @copyright  Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
 
36
 * @license    http://framework.zend.com/license/new-bsd     New BSD License
 
37
 */
 
38
abstract class Zend_Search_Lucene_Search_Weight
 
39
{
 
40
    /**
 
41
     * Normalization factor.
 
42
     * This value is stored only for query expanation purpose and not used in any other place
 
43
     *
 
44
     * @var float
 
45
     */
 
46
    protected $_queryNorm;
 
47
 
 
48
    /**
 
49
     * Weight value
 
50
     *
 
51
     * Weight value may be initialized in sumOfSquaredWeights() or normalize()
 
52
     * because they both are invoked either in Query::_initWeight (for top-level query) or
 
53
     * in corresponding methods of parent query's weights
 
54
     *
 
55
     * @var float
 
56
     */
 
57
    protected $_value;
 
58
 
 
59
 
 
60
    /**
 
61
     * The weight for this query.
 
62
     *
 
63
     * @return float
 
64
     */
 
65
    public function getValue()
 
66
    {
 
67
        return $this->_value;
 
68
    }
 
69
 
 
70
    /**
 
71
     * The sum of squared weights of contained query clauses.
 
72
     *
 
73
     * @return float
 
74
     */
 
75
    abstract public function sumOfSquaredWeights();
 
76
 
 
77
    /**
 
78
     * Assigns the query normalization factor to this.
 
79
     *
 
80
     * @param $norm
 
81
     */
 
82
    abstract public function normalize($norm);
 
83
}
 
84