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 | 95 | $append=false; |
| 96 | 96 | $clear=true; |
| 97 | 97 | break; |
| 98 | + case '~': | |
| 99 | + $this->token=SearchCommandParser::TILDE; | |
| 100 | + break; | |
| 98 | 101 | case '=': |
| 99 | 102 | $this->token=SearchCommandParser::IS; |
| 100 | 103 | break; |
| ... | ... | @@ -136,8 +139,8 @@ class SearchCommandLexer |
| 136 | 139 | } |
| 137 | 140 | elseif ($this->lookahead == '=') |
| 138 | 141 | { |
| 139 | - $this->zap(); | |
| 140 | 142 | $this->token=($this->char == '<')?(SearchCommandParser::LE):(SearchCommandParser::GE); |
| 143 | + $this->zap(); | |
| 141 | 144 | } |
| 142 | 145 | else |
| 143 | 146 | { |
| ... | ... | @@ -223,6 +226,9 @@ class SearchCommandLexer |
| 223 | 226 | { |
| 224 | 227 | switch($this->char) |
| 225 | 228 | { |
| 229 | + case '"': | |
| 230 | + $this->value .= '"'; | |
| 231 | + break; | |
| 226 | 232 | case 'r': |
| 227 | 233 | $this->value .= "\r"; |
| 228 | 234 | break; | ... | ... |
search2/search/expr.inc.php
| ... | ... | @@ -390,13 +390,14 @@ class FieldExpr extends Expr |
| 390 | 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 | 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 | 542 | */ |
| 542 | 543 | protected $value; |
| 543 | 544 | |
| 545 | + protected $fuzzy; | |
| 546 | + | |
| 547 | + protected $proximity; | |
| 548 | + | |
| 544 | 549 | /** |
| 545 | 550 | * Constructor for the value expression |
| 546 | 551 | * |
| 547 | 552 | * @param mixed $value |
| 548 | 553 | */ |
| 549 | - public function __construct($value) | |
| 554 | + public function __construct($value, $fuzzy=null, $proximity=null) | |
| 550 | 555 | { |
| 551 | 556 | parent::__construct(); |
| 552 | 557 | $this->value=$value; |
| 558 | + $this->fuzzy = $fuzzy; | |
| 559 | + $this->proximity = $proximity; | |
| 553 | 560 | } |
| 554 | 561 | |
| 555 | 562 | public function getValue() |
| 556 | 563 | { |
| 564 | + | |
| 557 | 565 | return $this->value; |
| 558 | 566 | } |
| 559 | 567 | |
| ... | ... | @@ -851,7 +859,14 @@ class TextQueryBuilder implements QueryBuilder |
| 851 | 859 | |
| 852 | 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 | 872 | return $query; |
| ... | ... | @@ -875,7 +890,10 @@ class TextQueryBuilder implements QueryBuilder |
| 875 | 890 | |
| 876 | 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 | 899 | return $query; |
| ... | ... | @@ -1931,7 +1949,8 @@ class OpExpr extends Expr |
| 1931 | 1949 | |
| 1932 | 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 | 1954 | $rs = DBUtil::getResultArray($sql); |
| 1936 | 1955 | |
| 1937 | 1956 | if (PEAR::isError($rs)) |
| ... | ... | @@ -1969,7 +1988,9 @@ class OpExpr extends Expr |
| 1969 | 1988 | } |
| 1970 | 1989 | |
| 1971 | 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 | 1994 | $results = $indexer->query($query); |
| 1974 | 1995 | foreach($results as $item) |
| 1975 | 1996 | { | ... | ... |
thirdparty/pear/GraphViz.php
| ... | ... | @@ -4,7 +4,7 @@ |
| 4 | 4 | /** |
| 5 | 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 | 8 | * Sebastian Bergmann <sb@sebastian-bergmann.de>. All rights reserved. |
| 9 | 9 | * |
| 10 | 10 | * LICENSE: This source file is subject to version 3.0 of the PHP license |
| ... | ... | @@ -15,7 +15,7 @@ |
| 15 | 15 | * |
| 16 | 16 | * @category Image |
| 17 | 17 | * @package GraphViz |
| 18 | - * @author Dr. Volker Göbbels <vmg@arachnion.de> | |
| 18 | + * @author Dr. Volker G�bbels <vmg@arachnion.de> | |
| 19 | 19 | * @author Sebastian Bergmann <sb@sebastian-bergmann.de> |
| 20 | 20 | * @author Karsten Dambekalns <k.dambekalns@fishfarm.de> |
| 21 | 21 | * @author Michael Lively Jr. <mlively@ft11.net> |
| ... | ... | @@ -90,10 +90,10 @@ require_once 'System.php'; |
| 90 | 90 | * @category Image |
| 91 | 91 | * @package GraphViz |
| 92 | 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 | 94 | * @author Karsten Dambekalns <k.dambekalns@fishfarm.de> |
| 95 | 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 | 97 | * @license http://www.php.net/license/3_0.txt The PHP License, Version 3.0 |
| 98 | 98 | * @version Release: @package_version@ |
| 99 | 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 | 205 | 'en' => 'The file was only partially uploaded.', |
| 206 | 206 | 'de' => 'Die Datei wurde unvollständig übertragen.', |
| 207 | 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 | 210 | 'ERROR' => array( |
| 211 | 211 | 'es' => 'Error en subida:', |
| ... | ... | @@ -215,7 +215,7 @@ class HTTP_Upload_Error extends PEAR |
| 215 | 215 | 'pt_BR' => 'Erro de upload:' |
| 216 | 216 | ), |
| 217 | 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 | 219 | 'en' => 'This filename is not defined in the form as <input type="file" name=?>.', |
| 220 | 220 | 'de' => 'Dieser Dateiname ist im Formular nicht als <input type="file" name=?> definiert.', |
| 221 | 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 | 660 | */ |
| 661 | 661 | function nameToSafe($name, $maxlen=250) |
| 662 | 662 | { |
| 663 | - $noalpha = 'ÁÉÍÓÚÝáéíóúýÂÊÎÔÛâêîôûÀÈÌÒÙàèìòùÄËÏÖÜäëïöüÿÃãÕõÅåÑñÇç@°ºª'; | |
| 663 | + $noalpha = '�����������������������������������������������������@���'; | |
| 664 | 664 | $alpha = 'AEIOUYaeiouyAEIOUaeiouAEIOUaeiouAEIOUaeiouyAaOoAaNnCcaooa'; |
| 665 | 665 | |
| 666 | 666 | $name = substr($name, 0, $maxlen); | ... | ... |
thirdparty/pear/Net/Ping.php
| ... | ... | @@ -16,7 +16,7 @@ |
| 16 | 16 | // | Authors: Martin Jansen <mj@php.net> | |
| 17 | 17 | // | Tomas V.V.Cox <cox@idecnet.com> | |
| 18 | 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 | 22 | // $Id$ |
| ... | ... | @@ -408,7 +408,7 @@ class Net_Ping |
| 408 | 408 | * @param mixed $error a PEAR error or a string with the error message |
| 409 | 409 | * @return bool false |
| 410 | 410 | * @access private |
| 411 | - * @author Kai Schröder <k.schroeder@php.net> | |
| 411 | + * @author Kai Schr�der <k.schroeder@php.net> | |
| 412 | 412 | */ |
| 413 | 413 | function _raiseError($error) |
| 414 | 414 | { |
| ... | ... | @@ -864,7 +864,7 @@ class Net_Ping_Result |
| 864 | 864 | /** |
| 865 | 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 | 868 | * @access private |
| 869 | 869 | */ |
| 870 | 870 | function _parseResultwindows() | ... | ... |