Subversion-Projekte lars-tiefland.prado

Revision

Details | Letzte Änderung | Log anzeigen | RSS feed

Revision Autor Zeilennr. Zeile
1 lars 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 Analysis
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
/** Zend_Search_Lucene_Analysis_Analyzer */
23
require_once 'Zend/Search/Lucene/Analysis/Analyzer.php';
24
 
25
 
26
/**
27
 * Common implementation of the Zend_Search_Lucene_Analysis_Analyzer interface.
28
 * There are several standard standard subclasses provided by Zend_Search_Lucene/Analysis
29
 * subpackage: Zend_Search_Lucene_Analysis_Analyzer_Common_Text, ZSearchHTMLAnalyzer, ZSearchXMLAnalyzer.
30
 *
31
 * @todo ZSearchHTMLAnalyzer and ZSearchXMLAnalyzer implementation
32
 *
33
 * @package    Zend_Search_Lucene
34
 * @subpackage Analysis
35
 * @copyright  Copyright (c) 2005-2006 Zend Technologies USA Inc. (http://www.zend.com)
36
 * @license    http://www.zend.com/license/framework/1_0.txt Zend Framework License version 1.0
37
 */
38
abstract class Zend_Search_Lucene_Analysis_Analyzer_Common extends Zend_Search_Lucene_Analysis_Analyzer
39
{
40
    /**
41
     * The set of Token filters applied to the Token stream.
42
     * Array of Zend_Search_Lucene_Analysis_TokenFilter objects.
43
     *
44
     * @var array
45
     */
46
    private $_filters = array();
47
 
48
    /**
49
     * Add Token filter to the Analyzer
50
     *
51
     * @param Zend_Search_Lucene_Analysis_TokenFilter $filter
52
     */
53
    public function addFilter(Zend_Search_Lucene_Analysis_TokenFilter $filter)
54
    {
55
        $this->_filters[] = $filter;
56
    }
57
 
58
    /**
59
     * Apply filters to the token.
60
     *
61
     * @param Zend_Search_Lucene_Analysis_Token $token
62
     * @return Zend_Search_Lucene_Analysis_Token
63
     */
64
    public function normalize(Zend_Search_Lucene_Analysis_Token $token)
65
    {
66
        foreach ($this->_filters as $filter) {
67
            $token = $filter->normalize($token);
68
        }
69
 
70
        return $token;
71
    }
72
}
73