| 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 Index
|
|
|
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 Term represents a word from text. This is the unit of search. It is
|
|
|
24 |
* composed of two elements, the text of the word, as a string, and the name of
|
|
|
25 |
* the field that the text occured in, an interned string.
|
|
|
26 |
*
|
|
|
27 |
* Note that terms may represent more than words from text fields, but also
|
|
|
28 |
* things like dates, email addresses, urls, etc.
|
|
|
29 |
*
|
|
|
30 |
* @package Zend_Search_Lucene
|
|
|
31 |
* @subpackage Index
|
|
|
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_Index_Term
|
|
|
36 |
{
|
|
|
37 |
/**
|
|
|
38 |
* Field name or field number (depending from context)
|
|
|
39 |
*
|
|
|
40 |
* @var mixed
|
|
|
41 |
*/
|
|
|
42 |
public $field;
|
|
|
43 |
|
|
|
44 |
/**
|
|
|
45 |
* Term value
|
|
|
46 |
*
|
|
|
47 |
* @var string
|
|
|
48 |
*/
|
|
|
49 |
public $text;
|
|
|
50 |
|
|
|
51 |
|
|
|
52 |
/**
|
|
|
53 |
* @todo docblock
|
|
|
54 |
*/
|
|
|
55 |
public function __construct( $text, $field = 'contents' )
|
|
|
56 |
{
|
|
|
57 |
$this->field = $field;
|
|
|
58 |
$this->text = $text;
|
|
|
59 |
}
|
|
|
60 |
|
|
|
61 |
|
|
|
62 |
/**
|
|
|
63 |
* @todo docblock
|
|
|
64 |
*/
|
|
|
65 |
public function key()
|
|
|
66 |
{
|
|
|
67 |
return $this->field . chr(0) . $this->text;
|
|
|
68 |
}
|
|
|
69 |
}
|
|
|
70 |
|