Commit 01636d8c78a4df9eebd102570abd54c22d057255

Authored by Paul Barrett
1 parent ecd8a882

KTS-4243. Changed the FolderField class to no longer alter the supplied search t…

…ext, which was causing the root folder contents to be included in the search

Fixed

Searching on a Folder criterion in the search query builder returns all (non-archived and non-deleted) documents in the root folder.

Committed by: Paul Barrett

Reviewd by: Megan Watson
search2/search/fields/FolderField.inc.php
@@ -43,7 +43,8 @@ class FolderField extends DBFieldExpr @@ -43,7 +43,8 @@ class FolderField extends DBFieldExpr
43 { 43 {
44 parent::__construct('full_path', 'documents', _kt('Folder')); 44 parent::__construct('full_path', 'documents', _kt('Folder'));
45 $this->setAlias('Folder'); 45 $this->setAlias('Folder');
46 - $this->isValueQuoted(false); 46 + // do want values quoted for folder db search
  47 + /*$this->isValueQuoted(false);*/
47 } 48 }
48 49
49 public function getInputRequirements() 50 public function getInputRequirements()
@@ -59,14 +60,17 @@ class FolderField extends DBFieldExpr @@ -59,14 +60,17 @@ class FolderField extends DBFieldExpr
59 public function modifyName($sql) 60 public function modifyName($sql)
60 { 61 {
61 $this->path = $sql; 62 $this->path = $sql;
62 - return "case when position('/' in $sql) = 0 then '/' else reverse(substring(reverse($sql) from position('/' in reverse($sql)) + 1 )) end"; 63 + return "case when position('/' in $sql) = 0 then '/' "
  64 + . "else reverse(substring(reverse($sql) from position('/' in reverse($sql)) + 1 )) end";
63 } 65 }
64 66
65 - 67 + // do not want to modify the value for a folder search
  68 + /*
66 public function modifyValue($value) 69 public function modifyValue($value)
67 { 70 {
68 return "case when position('/' in $this->path) = 0 then '/' else '$value' end"; 71 return "case when position('/' in $this->path) = 0 then '/' else '$value' end";
69 } 72 }
  73 + */
70 74
71 } 75 }
72 76