From d88cd616ad65e2f8b25f4e9ee5287faf5ac848f3 Mon Sep 17 00:00:00 2001 From: kevin_fourie Date: Fri, 8 Feb 2008 15:40:45 +0000 Subject: [PATCH] Merged in from DEV trunk... --- search2/search/SearchCommandLexer.php | 8 +++++++- search2/search/expr.inc.php | 37 +++++++++++++++++++++++++++++-------- thirdparty/pear/GraphViz.php | 8 ++++---- thirdparty/pear/HTTP/Upload.php | 6 +++--- thirdparty/pear/Net/Ping.php | 6 +++--- 5 files changed, 46 insertions(+), 19 deletions(-) diff --git a/search2/search/SearchCommandLexer.php b/search2/search/SearchCommandLexer.php index 1780084..fa0d329 100644 --- a/search2/search/SearchCommandLexer.php +++ b/search2/search/SearchCommandLexer.php @@ -95,6 +95,9 @@ class SearchCommandLexer $append=false; $clear=true; break; + case '~': + $this->token=SearchCommandParser::TILDE; + break; case '=': $this->token=SearchCommandParser::IS; break; @@ -136,8 +139,8 @@ class SearchCommandLexer } elseif ($this->lookahead == '=') { - $this->zap(); $this->token=($this->char == '<')?(SearchCommandParser::LE):(SearchCommandParser::GE); + $this->zap(); } else { @@ -223,6 +226,9 @@ class SearchCommandLexer { switch($this->char) { + case '"': + $this->value .= '"'; + break; case 'r': $this->value .= "\r"; break; diff --git a/search2/search/expr.inc.php b/search2/search/expr.inc.php index bccf485..4674a15 100644 --- a/search2/search/expr.inc.php +++ b/search2/search/expr.inc.php @@ -390,13 +390,14 @@ class FieldExpr extends Expr $value = $right; } - if (substr($value,0,1) != '\'' || substr($value,-1) != '\'') + if ((substr($value,0,1) == '\'' && substr($value,-1) == '\'') || (substr($value,0,1) == '"' && substr($value,-1) == '"')) { - OpExpr::rewriteString($left, $op, $right, $not); + $value = trim( substr($value,1,-1) ); + $right = new ValueExpr($value); } else { - $right = new ValueExpr(trim(substr($value,1,-1))); + OpExpr::rewriteString($left, $op, $right, $not); } } } @@ -541,19 +542,26 @@ class ValueExpr extends Expr */ protected $value; + protected $fuzzy; + + protected $proximity; + /** * Constructor for the value expression * * @param mixed $value */ - public function __construct($value) + public function __construct($value, $fuzzy=null, $proximity=null) { parent::__construct(); $this->value=$value; + $this->fuzzy = $fuzzy; + $this->proximity = $proximity; } public function getValue() { + return $this->value; } @@ -851,7 +859,14 @@ class TextQueryBuilder implements QueryBuilder $not = $expr->not()?' NOT ':''; - $query = "$not$fieldname: \"$value\""; + if (strpos($value, ' ') === false) + { + $query = "$not$fieldname: $value"; + } + else + { + $query = "$not$fieldname: \"$value\""; + } } return $query; @@ -875,7 +890,10 @@ class TextQueryBuilder implements QueryBuilder $not = $expr->not()?' NOT ':''; - $query .= "$not$fieldname: \"$value\""; + if (strpos($value, ' ') !== false) + $query .= "$not$fieldname: \"$value\""; + else + $query .= "$not$fieldname: $value"; } return $query; @@ -1931,7 +1949,8 @@ class OpExpr extends Expr $results = array(); - if ($this->debug) print "\n\n$sql\n\n"; + global $default; + $default->log->debug("SEARCH SQL: $sql"); $rs = DBUtil::getResultArray($sql); if (PEAR::isError($rs)) @@ -1969,7 +1988,9 @@ class OpExpr extends Expr } $indexer = Indexer::get(); - if ($this->debug) print "\n\n$query\n\n"; + global $default; + $default->log->debug("SEARCH LUCENE: $query"); + $results = $indexer->query($query); foreach($results as $item) { diff --git a/thirdparty/pear/GraphViz.php b/thirdparty/pear/GraphViz.php index 5224018..dd9b822 100644 --- a/thirdparty/pear/GraphViz.php +++ b/thirdparty/pear/GraphViz.php @@ -4,7 +4,7 @@ /** * Image_GraphViz * - * Copyright (c) 2001-2006, Dr. Volker Göbbels and + * Copyright (c) 2001-2006, Dr. Volker G�bbels and * Sebastian Bergmann . All rights reserved. * * LICENSE: This source file is subject to version 3.0 of the PHP license @@ -15,7 +15,7 @@ * * @category Image * @package GraphViz - * @author Dr. Volker Göbbels + * @author Dr. Volker G�bbels * @author Sebastian Bergmann * @author Karsten Dambekalns * @author Michael Lively Jr. @@ -90,10 +90,10 @@ require_once 'System.php'; * @category Image * @package GraphViz * @author Sebastian Bergmann - * @author Dr. Volker Göbbels + * @author Dr. Volker G�bbels * @author Karsten Dambekalns * @author Michael Lively Jr. - * @copyright Copyright © 2001-2006 Dr. Volker Göbbels and Sebastian Bergmann + * @copyright Copyright © 2001-2006 Dr. Volker G�bbels and Sebastian Bergmann * @license http://www.php.net/license/3_0.txt The PHP License, Version 3.0 * @version Release: @package_version@ * @link http://pear.php.net/package/Image_GraphViz diff --git a/thirdparty/pear/HTTP/Upload.php b/thirdparty/pear/HTTP/Upload.php index d2390e0..10b8276 100644 --- a/thirdparty/pear/HTTP/Upload.php +++ b/thirdparty/pear/HTTP/Upload.php @@ -205,7 +205,7 @@ class HTTP_Upload_Error extends PEAR 'en' => 'The file was only partially uploaded.', 'de' => 'Die Datei wurde unvollständig übertragen.', 'nl' => 'Het bestand is slechts gedeeltelijk geupload.', - 'pt_BR' => 'O arquivo não foi enviado por completo.' + 'pt_BR' => 'O arquivo n�o foi enviado por completo.' ), 'ERROR' => array( 'es' => 'Error en subida:', @@ -215,7 +215,7 @@ class HTTP_Upload_Error extends PEAR 'pt_BR' => 'Erro de upload:' ), 'DEV_NO_DEF_FILE' => array( - 'es' => 'No está definido en el formulario este nombre de fichero como <input type="file" name=?>.', + 'es' => 'No est� definido en el formulario este nombre de fichero como <input type="file" name=?>.', 'en' => 'This filename is not defined in the form as <input type="file" name=?>.', 'de' => 'Dieser Dateiname ist im Formular nicht als <input type="file" name=?> definiert.', '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 */ function nameToSafe($name, $maxlen=250) { - $noalpha = 'ÁÉÍÓÚÝáéíóúýÂÊÎÔÛâêîôûÀÈÌÒÙàèìòùÄËÏÖÜäëïöüÿÃãÕõÅåÑñÇç@°ºª'; + $noalpha = '�����������������������������������������������������@���'; $alpha = 'AEIOUYaeiouyAEIOUaeiouAEIOUaeiouAEIOUaeiouyAaOoAaNnCcaooa'; $name = substr($name, 0, $maxlen); diff --git a/thirdparty/pear/Net/Ping.php b/thirdparty/pear/Net/Ping.php index 8446cf5..b2c254b 100644 --- a/thirdparty/pear/Net/Ping.php +++ b/thirdparty/pear/Net/Ping.php @@ -16,7 +16,7 @@ // | Authors: Martin Jansen | // | Tomas V.V.Cox | // | Jan Lehnardt | -// | Kai Schröder | +// | Kai Schr�der | // +----------------------------------------------------------------------+ // // $Id$ @@ -408,7 +408,7 @@ class Net_Ping * @param mixed $error a PEAR error or a string with the error message * @return bool false * @access private - * @author Kai Schröder + * @author Kai Schr�der */ function _raiseError($error) { @@ -864,7 +864,7 @@ class Net_Ping_Result /** * Parses the output of Windows' ping command * - * @author Kai Schröder + * @author Kai Schr�der * @access private */ function _parseResultwindows() -- libgit2 0.21.4