GeneralTextField.inc.php
1021 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
<?php
class GeneralTextField extends SearchableText
{
public function __construct()
{
parent::__construct('General', _kt('General Text'));
$this->setAlias('GeneralText');
}
public function getInputRequirements()
{
return array('value'=>array('type'=>FieldInputType::TEXT));
}
public function is_valid()
{
return DefaultOpCollection::validateParent($this, DefaultOpCollection::$contains);
}
public function rewrite(&$left, &$op, &$right)
{
// note the grouping of the db queries
$left = new OpExpr(new DocumentTextField(), ExprOp::CONTAINS, $right);
$op = ExprOp::OP_OR;
$right = new OpExpr(
new OpExpr(new FilenameField(), ExprOp::CONTAINS, $right),
ExprOp::OP_OR,
new OpExpr(
new OpExpr(
new TitleField(), ExprOp::CONTAINS, $right),
ExprOp::OP_OR,
new OpExpr(new AnyMetadataField(), ExprOp::CONTAINS, $right)
)
);
}
}
?>