Commit d88cd616ad65e2f8b25f4e9ee5287faf5ac848f3
1 parent
f7a2e871
Merged in from DEV trunk...
KTS-2400 "Using double quotes in the new search system may be problematic" Fixed. Committed By: Conrad Vermeulen Reviewed By: Megan Watson git-svn-id: https://kt-dms.svn.sourceforge.net/svnroot/kt-dms/STABLE/trunk@8025 c91229c3-7414-0410-bfa2-8a42b809f60b
Showing
5 changed files
with
46 additions
and
19 deletions
search2/search/SearchCommandLexer.php
| @@ -95,6 +95,9 @@ class SearchCommandLexer | @@ -95,6 +95,9 @@ class SearchCommandLexer | ||
| 95 | $append=false; | 95 | $append=false; |
| 96 | $clear=true; | 96 | $clear=true; |
| 97 | break; | 97 | break; |
| 98 | + case '~': | ||
| 99 | + $this->token=SearchCommandParser::TILDE; | ||
| 100 | + break; | ||
| 98 | case '=': | 101 | case '=': |
| 99 | $this->token=SearchCommandParser::IS; | 102 | $this->token=SearchCommandParser::IS; |
| 100 | break; | 103 | break; |
| @@ -136,8 +139,8 @@ class SearchCommandLexer | @@ -136,8 +139,8 @@ class SearchCommandLexer | ||
| 136 | } | 139 | } |
| 137 | elseif ($this->lookahead == '=') | 140 | elseif ($this->lookahead == '=') |
| 138 | { | 141 | { |
| 139 | - $this->zap(); | ||
| 140 | $this->token=($this->char == '<')?(SearchCommandParser::LE):(SearchCommandParser::GE); | 142 | $this->token=($this->char == '<')?(SearchCommandParser::LE):(SearchCommandParser::GE); |
| 143 | + $this->zap(); | ||
| 141 | } | 144 | } |
| 142 | else | 145 | else |
| 143 | { | 146 | { |
| @@ -223,6 +226,9 @@ class SearchCommandLexer | @@ -223,6 +226,9 @@ class SearchCommandLexer | ||
| 223 | { | 226 | { |
| 224 | switch($this->char) | 227 | switch($this->char) |
| 225 | { | 228 | { |
| 229 | + case '"': | ||
| 230 | + $this->value .= '"'; | ||
| 231 | + break; | ||
| 226 | case 'r': | 232 | case 'r': |
| 227 | $this->value .= "\r"; | 233 | $this->value .= "\r"; |
| 228 | break; | 234 | break; |
search2/search/expr.inc.php
| @@ -390,13 +390,14 @@ class FieldExpr extends Expr | @@ -390,13 +390,14 @@ class FieldExpr extends Expr | ||
| 390 | $value = $right; | 390 | $value = $right; |
| 391 | } | 391 | } |
| 392 | 392 | ||
| 393 | - if (substr($value,0,1) != '\'' || substr($value,-1) != '\'') | 393 | + if ((substr($value,0,1) == '\'' && substr($value,-1) == '\'') || (substr($value,0,1) == '"' && substr($value,-1) == '"')) |
| 394 | { | 394 | { |
| 395 | - OpExpr::rewriteString($left, $op, $right, $not); | 395 | + $value = trim( substr($value,1,-1) ); |
| 396 | + $right = new ValueExpr($value); | ||
| 396 | } | 397 | } |
| 397 | else | 398 | else |
| 398 | { | 399 | { |
| 399 | - $right = new ValueExpr(trim(substr($value,1,-1))); | 400 | + OpExpr::rewriteString($left, $op, $right, $not); |
| 400 | } | 401 | } |
| 401 | } | 402 | } |
| 402 | } | 403 | } |
| @@ -541,19 +542,26 @@ class ValueExpr extends Expr | @@ -541,19 +542,26 @@ class ValueExpr extends Expr | ||
| 541 | */ | 542 | */ |
| 542 | protected $value; | 543 | protected $value; |
| 543 | 544 | ||
| 545 | + protected $fuzzy; | ||
| 546 | + | ||
| 547 | + protected $proximity; | ||
| 548 | + | ||
| 544 | /** | 549 | /** |
| 545 | * Constructor for the value expression | 550 | * Constructor for the value expression |
| 546 | * | 551 | * |
| 547 | * @param mixed $value | 552 | * @param mixed $value |
| 548 | */ | 553 | */ |
| 549 | - public function __construct($value) | 554 | + public function __construct($value, $fuzzy=null, $proximity=null) |
| 550 | { | 555 | { |
| 551 | parent::__construct(); | 556 | parent::__construct(); |
| 552 | $this->value=$value; | 557 | $this->value=$value; |
| 558 | + $this->fuzzy = $fuzzy; | ||
| 559 | + $this->proximity = $proximity; | ||
| 553 | } | 560 | } |
| 554 | 561 | ||
| 555 | public function getValue() | 562 | public function getValue() |
| 556 | { | 563 | { |
| 564 | + | ||
| 557 | return $this->value; | 565 | return $this->value; |
| 558 | } | 566 | } |
| 559 | 567 | ||
| @@ -851,7 +859,14 @@ class TextQueryBuilder implements QueryBuilder | @@ -851,7 +859,14 @@ class TextQueryBuilder implements QueryBuilder | ||
| 851 | 859 | ||
| 852 | $not = $expr->not()?' NOT ':''; | 860 | $not = $expr->not()?' NOT ':''; |
| 853 | 861 | ||
| 854 | - $query = "$not$fieldname: \"$value\""; | 862 | + if (strpos($value, ' ') === false) |
| 863 | + { | ||
| 864 | + $query = "$not$fieldname: $value"; | ||
| 865 | + } | ||
| 866 | + else | ||
| 867 | + { | ||
| 868 | + $query = "$not$fieldname: \"$value\""; | ||
| 869 | + } | ||
| 855 | } | 870 | } |
| 856 | 871 | ||
| 857 | return $query; | 872 | return $query; |
| @@ -875,7 +890,10 @@ class TextQueryBuilder implements QueryBuilder | @@ -875,7 +890,10 @@ class TextQueryBuilder implements QueryBuilder | ||
| 875 | 890 | ||
| 876 | $not = $expr->not()?' NOT ':''; | 891 | $not = $expr->not()?' NOT ':''; |
| 877 | 892 | ||
| 878 | - $query .= "$not$fieldname: \"$value\""; | 893 | + if (strpos($value, ' ') !== false) |
| 894 | + $query .= "$not$fieldname: \"$value\""; | ||
| 895 | + else | ||
| 896 | + $query .= "$not$fieldname: $value"; | ||
| 879 | } | 897 | } |
| 880 | 898 | ||
| 881 | return $query; | 899 | return $query; |
| @@ -1931,7 +1949,8 @@ class OpExpr extends Expr | @@ -1931,7 +1949,8 @@ class OpExpr extends Expr | ||
| 1931 | 1949 | ||
| 1932 | $results = array(); | 1950 | $results = array(); |
| 1933 | 1951 | ||
| 1934 | - if ($this->debug) print "\n\n$sql\n\n"; | 1952 | + global $default; |
| 1953 | + $default->log->debug("SEARCH SQL: $sql"); | ||
| 1935 | $rs = DBUtil::getResultArray($sql); | 1954 | $rs = DBUtil::getResultArray($sql); |
| 1936 | 1955 | ||
| 1937 | if (PEAR::isError($rs)) | 1956 | if (PEAR::isError($rs)) |
| @@ -1969,7 +1988,9 @@ class OpExpr extends Expr | @@ -1969,7 +1988,9 @@ class OpExpr extends Expr | ||
| 1969 | } | 1988 | } |
| 1970 | 1989 | ||
| 1971 | $indexer = Indexer::get(); | 1990 | $indexer = Indexer::get(); |
| 1972 | - if ($this->debug) print "\n\n$query\n\n"; | 1991 | + global $default; |
| 1992 | + $default->log->debug("SEARCH LUCENE: $query"); | ||
| 1993 | + | ||
| 1973 | $results = $indexer->query($query); | 1994 | $results = $indexer->query($query); |
| 1974 | foreach($results as $item) | 1995 | foreach($results as $item) |
| 1975 | { | 1996 | { |
thirdparty/pear/GraphViz.php
| @@ -4,7 +4,7 @@ | @@ -4,7 +4,7 @@ | ||
| 4 | /** | 4 | /** |
| 5 | * Image_GraphViz | 5 | * Image_GraphViz |
| 6 | * | 6 | * |
| 7 | - * Copyright (c) 2001-2006, Dr. Volker Göbbels <vmg@arachnion.de> and | 7 | + * Copyright (c) 2001-2006, Dr. Volker G�bbels <vmg@arachnion.de> and |
| 8 | * Sebastian Bergmann <sb@sebastian-bergmann.de>. All rights reserved. | 8 | * Sebastian Bergmann <sb@sebastian-bergmann.de>. All rights reserved. |
| 9 | * | 9 | * |
| 10 | * LICENSE: This source file is subject to version 3.0 of the PHP license | 10 | * LICENSE: This source file is subject to version 3.0 of the PHP license |
| @@ -15,7 +15,7 @@ | @@ -15,7 +15,7 @@ | ||
| 15 | * | 15 | * |
| 16 | * @category Image | 16 | * @category Image |
| 17 | * @package GraphViz | 17 | * @package GraphViz |
| 18 | - * @author Dr. Volker Göbbels <vmg@arachnion.de> | 18 | + * @author Dr. Volker G�bbels <vmg@arachnion.de> |
| 19 | * @author Sebastian Bergmann <sb@sebastian-bergmann.de> | 19 | * @author Sebastian Bergmann <sb@sebastian-bergmann.de> |
| 20 | * @author Karsten Dambekalns <k.dambekalns@fishfarm.de> | 20 | * @author Karsten Dambekalns <k.dambekalns@fishfarm.de> |
| 21 | * @author Michael Lively Jr. <mlively@ft11.net> | 21 | * @author Michael Lively Jr. <mlively@ft11.net> |
| @@ -90,10 +90,10 @@ require_once 'System.php'; | @@ -90,10 +90,10 @@ require_once 'System.php'; | ||
| 90 | * @category Image | 90 | * @category Image |
| 91 | * @package GraphViz | 91 | * @package GraphViz |
| 92 | * @author Sebastian Bergmann <sb@sebastian-bergmann.de> | 92 | * @author Sebastian Bergmann <sb@sebastian-bergmann.de> |
| 93 | - * @author Dr. Volker Göbbels <vmg@arachnion.de> | 93 | + * @author Dr. Volker G�bbels <vmg@arachnion.de> |
| 94 | * @author Karsten Dambekalns <k.dambekalns@fishfarm.de> | 94 | * @author Karsten Dambekalns <k.dambekalns@fishfarm.de> |
| 95 | * @author Michael Lively Jr. <mlively@ft11.net> | 95 | * @author Michael Lively Jr. <mlively@ft11.net> |
| 96 | - * @copyright Copyright © 2001-2006 Dr. Volker Göbbels <vmg@arachnion.de> and Sebastian Bergmann <sb@sebastian-bergmann.de> | 96 | + * @copyright Copyright © 2001-2006 Dr. Volker G�bbels <vmg@arachnion.de> and Sebastian Bergmann <sb@sebastian-bergmann.de> |
| 97 | * @license http://www.php.net/license/3_0.txt The PHP License, Version 3.0 | 97 | * @license http://www.php.net/license/3_0.txt The PHP License, Version 3.0 |
| 98 | * @version Release: @package_version@ | 98 | * @version Release: @package_version@ |
| 99 | * @link http://pear.php.net/package/Image_GraphViz | 99 | * @link http://pear.php.net/package/Image_GraphViz |
thirdparty/pear/HTTP/Upload.php
| @@ -205,7 +205,7 @@ class HTTP_Upload_Error extends PEAR | @@ -205,7 +205,7 @@ class HTTP_Upload_Error extends PEAR | ||
| 205 | 'en' => 'The file was only partially uploaded.', | 205 | 'en' => 'The file was only partially uploaded.', |
| 206 | 'de' => 'Die Datei wurde unvollständig übertragen.', | 206 | 'de' => 'Die Datei wurde unvollständig übertragen.', |
| 207 | 'nl' => 'Het bestand is slechts gedeeltelijk geupload.', | 207 | 'nl' => 'Het bestand is slechts gedeeltelijk geupload.', |
| 208 | - 'pt_BR' => 'O arquivo não foi enviado por completo.' | 208 | + 'pt_BR' => 'O arquivo n�o foi enviado por completo.' |
| 209 | ), | 209 | ), |
| 210 | 'ERROR' => array( | 210 | 'ERROR' => array( |
| 211 | 'es' => 'Error en subida:', | 211 | 'es' => 'Error en subida:', |
| @@ -215,7 +215,7 @@ class HTTP_Upload_Error extends PEAR | @@ -215,7 +215,7 @@ class HTTP_Upload_Error extends PEAR | ||
| 215 | 'pt_BR' => 'Erro de upload:' | 215 | 'pt_BR' => 'Erro de upload:' |
| 216 | ), | 216 | ), |
| 217 | 'DEV_NO_DEF_FILE' => array( | 217 | 'DEV_NO_DEF_FILE' => array( |
| 218 | - 'es' => 'No está definido en el formulario este nombre de fichero como <input type="file" name=?>.', | 218 | + 'es' => 'No est� definido en el formulario este nombre de fichero como <input type="file" name=?>.', |
| 219 | 'en' => 'This filename is not defined in the form as <input type="file" name=?>.', | 219 | 'en' => 'This filename is not defined in the form as <input type="file" name=?>.', |
| 220 | 'de' => 'Dieser Dateiname ist im Formular nicht als <input type="file" name=?> definiert.', | 220 | 'de' => 'Dieser Dateiname ist im Formular nicht als <input type="file" name=?> definiert.', |
| 221 | 'nl' => 'Deze bestandsnaam is niett gedefineerd in het formulier als <input type="file" name=?>.' | 221 | 'nl' => 'Deze bestandsnaam is niett gedefineerd in het formulier als <input type="file" name=?>.' |
| @@ -660,7 +660,7 @@ class HTTP_Upload_File extends HTTP_Upload_Error | @@ -660,7 +660,7 @@ class HTTP_Upload_File extends HTTP_Upload_Error | ||
| 660 | */ | 660 | */ |
| 661 | function nameToSafe($name, $maxlen=250) | 661 | function nameToSafe($name, $maxlen=250) |
| 662 | { | 662 | { |
| 663 | - $noalpha = 'ÁÉÍÓÚÝáéíóúýÂÊÎÔÛâêîôûÀÈÌÒÙàèìòùÄËÏÖÜäëïöüÿÃãÕõÅåÑñÇç@°ºª'; | 663 | + $noalpha = '�����������������������������������������������������@���'; |
| 664 | $alpha = 'AEIOUYaeiouyAEIOUaeiouAEIOUaeiouAEIOUaeiouyAaOoAaNnCcaooa'; | 664 | $alpha = 'AEIOUYaeiouyAEIOUaeiouAEIOUaeiouAEIOUaeiouyAaOoAaNnCcaooa'; |
| 665 | 665 | ||
| 666 | $name = substr($name, 0, $maxlen); | 666 | $name = substr($name, 0, $maxlen); |
thirdparty/pear/Net/Ping.php
| @@ -16,7 +16,7 @@ | @@ -16,7 +16,7 @@ | ||
| 16 | // | Authors: Martin Jansen <mj@php.net> | | 16 | // | Authors: Martin Jansen <mj@php.net> | |
| 17 | // | Tomas V.V.Cox <cox@idecnet.com> | | 17 | // | Tomas V.V.Cox <cox@idecnet.com> | |
| 18 | // | Jan Lehnardt <jan@php.net> | | 18 | // | Jan Lehnardt <jan@php.net> | |
| 19 | -// | Kai Schröder <k.schroeder@php.net> | | 19 | +// | Kai Schr�der <k.schroeder@php.net> | |
| 20 | // +----------------------------------------------------------------------+ | 20 | // +----------------------------------------------------------------------+ |
| 21 | // | 21 | // |
| 22 | // $Id$ | 22 | // $Id$ |
| @@ -408,7 +408,7 @@ class Net_Ping | @@ -408,7 +408,7 @@ class Net_Ping | ||
| 408 | * @param mixed $error a PEAR error or a string with the error message | 408 | * @param mixed $error a PEAR error or a string with the error message |
| 409 | * @return bool false | 409 | * @return bool false |
| 410 | * @access private | 410 | * @access private |
| 411 | - * @author Kai Schröder <k.schroeder@php.net> | 411 | + * @author Kai Schr�der <k.schroeder@php.net> |
| 412 | */ | 412 | */ |
| 413 | function _raiseError($error) | 413 | function _raiseError($error) |
| 414 | { | 414 | { |
| @@ -864,7 +864,7 @@ class Net_Ping_Result | @@ -864,7 +864,7 @@ class Net_Ping_Result | ||
| 864 | /** | 864 | /** |
| 865 | * Parses the output of Windows' ping command | 865 | * Parses the output of Windows' ping command |
| 866 | * | 866 | * |
| 867 | - * @author Kai Schröder <k.schroeder@php.net> | 867 | + * @author Kai Schr�der <k.schroeder@php.net> |
| 868 | * @access private | 868 | * @access private |
| 869 | */ | 869 | */ |
| 870 | function _parseResultwindows() | 870 | function _parseResultwindows() |