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_Token */
23
require_once 'Zend/Search/Lucene/Analysis/Token.php';
24
 
25
/** Zend_Search_Lucene_Analysis_Analyzer_Common_Text */
26
require_once 'Zend/Search/Lucene/Analysis/Analyzer/Common/Text.php';
27
 
28
/** Zend_Search_Lucene_Analysis_Analyzer_Common_Text_CaseInsensitive */
29
require_once 'Zend/Search/Lucene/Analysis/Analyzer/Common/Text/CaseInsensitive.php';
30
 
31
 
32
 
33
/**
34
 * An Analyzer is used to analyze text.
35
 * It thus represents a policy for extracting index terms from text.
36
 *
37
 * Note:
38
 * Lucene Java implementation is oriented to streams. It provides effective work
39
 * with a huge documents (more then 20Mb).
40
 * But engine itself is not oriented such documents.
41
 * Thus Zend_Search_Lucene analysis API works with data strings and sets (arrays).
42
 *
43
 * @package    Zend_Search_Lucene
44
 * @subpackage Analysis
45
 * @copyright  Copyright (c) 2005-2006 Zend Technologies USA Inc. (http://www.zend.com)
46
 * @license    http://www.zend.com/license/framework/1_0.txt Zend Framework License version 1.0
47
 */
48
 
49
abstract class Zend_Search_Lucene_Analysis_Analyzer
50
{
51
    /**
52
     * The Analyzer implementation used by default.
53
     *
54
     * @var Zend_Search_Lucene_Analysis_Analyzer
55
     */
56
    static private $_defaultImpl;
57
 
58
    /**
59
     * Tokenize text to a terms
60
     * Returns array of Zend_Search_Lucene_Analysis_Token objects
61
     *
62
     * @param string $data
63
     * @return array
64
     */
65
    abstract public function tokenize($data);
66
 
67
 
68
    /**
69
     * Set the default Analyzer implementation used by indexing code.
70
     *
71
     * @param Zend_Search_Lucene_Analysis_Analyzer $similarity
72
     */
73
    static public function setDefault(Zend_Search_Lucene_Analysis_Analyzer $analyzer)
74
    {
75
        self::$_defaultImpl = $analyzer;
76
    }
77
 
78
 
79
    /**
80
     * Return the default Analyzer implementation used by indexing code.
81
     *
82
     * @return Zend_Search_Lucene_Analysis_Analyzer
83
     */
84
    static public function getDefault()
85
    {
86
        if (!self::$_defaultImpl instanceof Zend_Search_Lucene_Analysis_Analyzer) {
87
            self::$_defaultImpl = new Zend_Search_Lucene_Analysis_Analyzer_Common_Text_CaseInsensitive();
88
        }
89
 
90
        return self::$_defaultImpl;
91
    }
92
 
93
}
94