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 document
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
 * A field is a section of a Document.  Each field has two parts,
24
 * a name and a value. Values may be free text or they may be atomic
25
 * keywords, which are not further processed. Such keywords may
26
 * be used to represent dates, urls, etc.  Fields are optionally
27
 * stored in the index, so that they may be returned with hits
28
 * on the document.
29
 *
30
 * @package    Zend_Search_Lucene
31
 * @subpackage document
32
 * @copyright  Copyright (c) 2005-2006 Zend Technologies USA Inc. (http://www.zend.com)
33
 * @license    http://www.zend.com/license/framework/1_0.txt Zend Framework License version 1.0
34
 */
35
class Zend_Search_Lucene_Field
36
{
37
    public $kind;
38
 
39
    public $name        = 'body';
40
    public $stringValue = null;
41
    public $isStored    = false;
42
    public $isIndexed   = true;
43
    public $isTokenized = true;
44
    public $isBinary    = false;
45
 
46
    public $storeTermVector = false;
47
 
48
    public $boost = 1.0;
49
 
50
    public function __construct($name, $stringValue, $isStored, $isIndexed, $isTokenized, $isBinary = false)
51
    {
52
        $this->name        = $name;
53
        $this->stringValue = $stringValue;
54
        $this->isStored    = $isStored;
55
        $this->isIndexed   = $isIndexed;
56
        $this->isTokenized = $isTokenized;
57
        $this->isBinary    = $isBinary;
58
 
59
        $this->storeTermVector = false;
60
        $this->boost           = 1.0;
61
    }
62
 
63
 
64
    /**
65
     * Constructs a String-valued Field that is not tokenized, but is indexed
66
     * and stored.  Useful for non-text fields, e.g. date or url.
67
     *
68
     * @param string $name
69
     * @param string $value
70
     * @return Zend_Search_Lucene_Field
71
     */
72
    static public function Keyword($name, $value)
73
    {
74
        return new self($name, $value, true, true, false);
75
    }
76
 
77
 
78
    /**
79
     * Constructs a String-valued Field that is not tokenized nor indexed,
80
     * but is stored in the index, for return with hits.
81
     *
82
     * @param string $name
83
     * @param string $value
84
     * @return Zend_Search_Lucene_Field
85
     */
86
    static public function UnIndexed($name, $value)
87
    {
88
        return new self($name, $value, true, false, false);
89
    }
90
 
91
 
92
    /**
93
     * Constructs a Binary String valued Field that is not tokenized nor indexed,
94
     * but is stored in the index, for return with hits.
95
     *
96
     * @param string $name
97
     * @param string $value
98
     * @return Zend_Search_Lucene_Field
99
     */
100
    static public function Binary($name, $value)
101
    {
102
        return new self($name, $value, true, false, false, true);
103
    }
104
 
105
    /**
106
     * Constructs a String-valued Field that is tokenized and indexed,
107
     * and is stored in the index, for return with hits.  Useful for short text
108
     * fields, like "title" or "subject". Term vector will not be stored for this field.
109
     *
110
     * @param string $name
111
     * @param string $value
112
     * @return Zend_Search_Lucene_Field
113
     */
114
    static public function Text($name, $value)
115
    {
116
        return new self($name, $value, true, true, true);
117
    }
118
 
119
 
120
    /**
121
     * Constructs a String-valued Field that is tokenized and indexed,
122
     * but that is not stored in the index.
123
     *
124
     * @param string $name
125
     * @param string $value
126
     * @return Zend_Search_Lucene_Field
127
     */
128
    static public function UnStored($name, $value)
129
    {
130
        return new self($name, $value, false, true, true);
131
    }
132
 
133
}
134