diff --git a/search2.php b/search2.php index 149eecd..1c97ca6 100644 --- a/search2.php +++ b/search2.php @@ -776,7 +776,6 @@ class SearchDispatcher extends KTStandardDispatcher { } } - $oDispatcher = new SearchDispatcher(); $oDispatcher->dispatch(); diff --git a/search2/search/expr.inc.php b/search2/search/expr.inc.php index c501dbe..780953d 100755 --- a/search2/search/expr.inc.php +++ b/search2/search/expr.inc.php @@ -49,8 +49,6 @@ require_once('search/fieldRegistry.inc.php'); require_once('search/exprConstants.inc.php'); /** - * - * * This class handles the ranking of search results * * @author KnowledgeTree Team @@ -794,7 +792,6 @@ class ValueListExpr extends Expr $this->values[] = $value; } - public function getValue($param=null) { if (!empty($param)) @@ -950,6 +947,7 @@ interface QueryBuilder /** * This class builds queries for text content searches + * which are run through the Lucene service * * @author KnowledgeTree Team * @package Search @@ -1111,8 +1109,7 @@ class SQLQueryBuilder implements QueryBuilder } /** - * Sets the value which determines whether archived/deleted documents - * are to be included in search results + * Sets the value which determines whether status must be 1 to return results * * @author KnowledgeTree Team * @access public diff --git a/search2/search/fields/AnyMetadataField.inc.php b/search2/search/fields/AnyMetadataField.inc.php index 978c825..85a983a 100755 --- a/search2/search/fields/AnyMetadataField.inc.php +++ b/search2/search/fields/AnyMetadataField.inc.php @@ -39,46 +39,21 @@ class AnyMetadataField extends DBFieldExpr { + // declare as part of GeneralText search public $general_op = ExprOp::CONTAINS; -// public $references = 0; public function __construct() { -// parent::__construct('value', 'document_fields_link', _kt('Any Metadata')); + /* + * Constructing the object like this allows for easy multiple joins + * on the same column in the same table + */ parent::__construct('id', 'document_metadata_version', _kt('Any Metadata')); $this->setAlias('Metadata'); $this->joinTo('document_fields_link', 'metadata_version_id'); $this->matchField('value'); } - /* - * Overridden function to adjust table alias in cases of - * the document_fields_link table being included more than once - * - * NOTE this only works in conjunction with code in expr.inc.php which adds the left joins to the db query. - * I don't like this and think we should look for a way to make the table joining more generic - * such that it can be controlled via these classes and thereby contained as a unit. - */ -// public function modifyName($name) -// { -// if ($this->references > 0) -// { -// static $count = 0; -// if ($count >= $this->references) -// { -// $count = 0; -// } -// -// if ((($pos = strpos($name, '.')) !== false) && ($count != 0)) -// { -// $name = substr($name, 0, $pos) . $count . substr($name, $pos); -// } -// ++$count; -// } -// -// return $name; -// } - public function getInputRequirements() { return array('value'=>array('type'=>FieldInputType::TEXT)); diff --git a/search2/search/fields/DiscussionTextField.inc.php b/search2/search/fields/DiscussionTextField.inc.php index 73ea321..5124c87 100755 --- a/search2/search/fields/DiscussionTextField.inc.php +++ b/search2/search/fields/DiscussionTextField.inc.php @@ -39,6 +39,7 @@ class DiscussionTextField extends SearchableText { + // declare as part of GeneralText search public $general_op = ExprOp::CONTAINS; public function __construct() diff --git a/search2/search/fields/DocumentIdField.inc.php b/search2/search/fields/DocumentIdField.inc.php index a8e8c90..d6a2708 100755 --- a/search2/search/fields/DocumentIdField.inc.php +++ b/search2/search/fields/DocumentIdField.inc.php @@ -39,6 +39,7 @@ class DocumentIdField extends DBFieldExpr { + // declare as part of GeneralText search public $general_op = ExprOp::IS; public function __construct() diff --git a/search2/search/fields/FilenameField.inc.php b/search2/search/fields/FilenameField.inc.php index 1b3855e..eebf682 100755 --- a/search2/search/fields/FilenameField.inc.php +++ b/search2/search/fields/FilenameField.inc.php @@ -39,9 +39,9 @@ class FilenameField extends DBFieldExpr { + // declare as part of GeneralText search public $general_op = ExprOp::CONTAINS; - public function __construct() { parent::__construct('filename', 'document_content_version', _kt('Filename')); diff --git a/search2/search/fields/FullPathField.inc.php b/search2/search/fields/FullPathField.inc.php index 8250c77..7bcb19d 100644 --- a/search2/search/fields/FullPathField.inc.php +++ b/search2/search/fields/FullPathField.inc.php @@ -39,6 +39,7 @@ class FullPathField extends DBFieldExpr { + // declare as part of GeneralText search public $general_op = ExprOp::CONTAINS; public function __construct() diff --git a/search2/search/fields/GeneralTextField.inc.php b/search2/search/fields/GeneralTextField.inc.php index 12c52c1..8af694e 100755 --- a/search2/search/fields/GeneralTextField.inc.php +++ b/search2/search/fields/GeneralTextField.inc.php @@ -37,6 +37,26 @@ * */ +/** + * Class to combine multiple search fields under the heading of GeneralText search + * + * Fields are added to the GeneralText search by declaring and initialising the + * ${fieldclass}->general_op variable within the field class you would like to + * include in the GeneralText search. To do this, add the following class variable + * declaration: + * + * public $general_op = ExprOp::CONTAINS; + * + * At the time of writing (2009/05/15) the following field classes are included: + * + * AnyMetadataField + * DiscussionTextField + * DocumentIdField + * FilenameField + * FullPathField + * TitleField + * + */ class GeneralTextField extends SearchableText { public function __construct() @@ -83,10 +103,7 @@ class GeneralTextField extends SearchableText $right = new OpExpr($right, ExprOp::OP_OR, $newexpr); } } - } - - } ?> diff --git a/search2/search/fields/TitleField.inc.php b/search2/search/fields/TitleField.inc.php index 24d6edf..34d2ea1 100755 --- a/search2/search/fields/TitleField.inc.php +++ b/search2/search/fields/TitleField.inc.php @@ -39,6 +39,7 @@ class TitleField extends DBFieldExpr { + // declare as part of GeneralText search public $general_op = ExprOp::CONTAINS; public function __construct()