spec/fixtures/sphinxapi.0.9.9.php in riddle-1.5.1 vs spec/fixtures/sphinxapi.0.9.9.php in riddle-1.5.2

- old
+ new

@@ -116,11 +116,11 @@ /// pack 64-bit signed function sphPackI64 ( $v ) { assert ( is_numeric($v) ); - + // x64 if ( PHP_INT_SIZE>=8 ) { $v = (int)$v; return pack ( "NN", $v>>32, $v&0xFFFFFFFF ); @@ -128,11 +128,11 @@ // x32, int if ( is_int($v) ) return pack ( "NN", $v < 0 ? -1 : 0, $v ); - // x32, bcmath + // x32, bcmath if ( function_exists("bcmul") ) { if ( bccomp ( $v, 0 ) == -1 ) $v = bcadd ( "18446744073709551616", $v ); $h = bcdiv ( $v, "4294967296", 0 ); @@ -165,44 +165,44 @@ /// pack 64-bit unsigned function sphPackU64 ( $v ) { assert ( is_numeric($v) ); - + // x64 if ( PHP_INT_SIZE>=8 ) { assert ( $v>=0 ); - + // x64, int if ( is_int($v) ) return pack ( "NN", $v>>32, $v&0xFFFFFFFF ); - + // x64, bcmath if ( function_exists("bcmul") ) { $h = bcdiv ( $v, 4294967296, 0 ); $l = bcmod ( $v, 4294967296 ); return pack ( "NN", $h, $l ); } - + // x64, no-bcmath $p = max ( 0, strlen($v) - 13 ); $lo = (int)substr ( $v, $p ); $hi = (int)substr ( $v, 0, $p ); - + $m = $lo + $hi*1316134912; $l = $m % 4294967296; $h = $hi*2328 + (int)($m/4294967296); return pack ( "NN", $h, $l ); } // x32, int if ( is_int($v) ) return pack ( "NN", 0, $v ); - + // x32, bcmath if ( function_exists("bcmul") ) { $h = bcdiv ( $v, "4294967296", 0 ); $l = bcmod ( $v, "4294967296" ); @@ -211,11 +211,11 @@ // x32, no-bcmath $p = max(0, strlen($v) - 13); $lo = (float)substr($v, $p); $hi = (float)substr($v, 0, $p); - + $m = $lo + $hi*1316134912.0; $q = floor($m / 4294967296.0); $l = $m - ($q * 4294967296.0); $h = $hi*2328.0 + $q; @@ -267,15 +267,15 @@ $lo = sprintf ( "%u", $lo ); // x32, bcmath if ( function_exists("bcmul") ) return bcadd ( $lo, bcmul ( $hi, "4294967296" ) ); - + // x32, no-bcmath $hi = (float)$hi; $lo = (float)$lo; - + $q = floor($hi/10000000.0); $r = $hi - $q*10000000.0; $m = $lo + $r*4967296.0; $mq = floor($m/10000000.0); $l = $m - $mq*10000000.0; @@ -314,20 +314,20 @@ { if ( $lo<0 ) return $lo; return sprintf ( "%.0f", $lo - 4294967296.0 ); } - + $neg = ""; $c = 0; if ( $hi<0 ) { $hi = ~$hi; $lo = ~$lo; $c = 1; $neg = "-"; - } + } $hi = sprintf ( "%u", $hi ); $lo = sprintf ( "%u", $lo ); // x32, bcmath @@ -335,11 +335,11 @@ return $neg . bcadd ( bcadd ( $lo, bcmul ( $hi, "4294967296" ) ), $c ); // x32, no-bcmath $hi = (float)$hi; $lo = (float)$lo; - + $q = floor($hi/10000000.0); $r = $hi - $q*10000000.0; $m = $lo + $r*4967296.0; $mq = floor($m/10000000.0); $l = $m - $mq*10000000.0 + $c; @@ -415,11 +415,11 @@ $this->_min_id = 0; $this->_max_id = 0; $this->_filters = array (); $this->_groupby = ""; $this->_groupfunc = SPH_GROUPBY_DAY; - $this->_groupsort = "@group desc"; + $this->_groupsort = "@weight DESC"; $this->_groupdistinct= ""; $this->_maxmatches = 1000; $this->_cutoff = 0; $this->_retrycount = 0; $this->_retrydelay = 0; @@ -477,11 +477,11 @@ if ( substr ( $host, 0, 7 )=="unix://" ) { $this->_path = $host; return; } - + assert ( is_int($port) ); $this->_host = $host; $this->_port = $port; $this->_path = ''; @@ -549,18 +549,18 @@ if ( $this->_timeout<=0 ) $fp = @fsockopen ( $host, $port, $errno, $errstr ); else $fp = @fsockopen ( $host, $port, $errno, $errstr, $this->_timeout ); - + if ( !$fp ) { if ( $this->_path ) $location = $this->_path; else $location = "{$this->_host}:{$this->_port}"; - + $errstr = trim ( $errstr ); $this->_error = "connection to $location failed (errno=$errno, msg=$errstr)"; $this->_connerror = true; return false; } @@ -899,11 +899,11 @@ /// clear groupby settings (for multi-queries) function ResetGroupBy () { $this->_groupby = ""; $this->_groupfunc = SPH_GROUPBY_DAY; - $this->_groupsort = "@group desc"; + $this->_groupsort = "@weight DESC"; $this->_groupdistinct= ""; } /// clear all attribute value overrides (for multi-queries) function ResetOverrides () @@ -1203,11 +1203,11 @@ // handle floats if ( $type==SPH_ATTR_FLOAT ) { list(,$uval) = unpack ( "N*", substr ( $response, $p, 4 ) ); $p += 4; - list(,$fval) = unpack ( "f*", pack ( "L", $uval ) ); + list(,$fval) = unpack ( "f*", pack ( "L", $uval ) ); $attrvals[$attr] = $fval; continue; } // handle everything else as unsigned ints @@ -1373,11 +1373,11 @@ assert ( is_string($index) ); assert ( is_bool($hits) ); // Commented out for testing Riddle // $this->_MBPush (); - // + // // if (!( $fp = $this->_Connect() )) // { // $this->_MBPop(); // return false; // } @@ -1388,11 +1388,11 @@ // v.1.0 req $req = pack ( "N", strlen($query) ) . $query; // req query $req .= pack ( "N", strlen($index) ) . $index; // req index $req .= pack ( "N", (int)$hits ); - + // Line for testing Riddle: return $req; //////////////////////////// // send query, get response @@ -1510,11 +1510,11 @@ if ( $mva ) foreach ( $v as $vv ) $req .= pack ( "N", $vv ); } } - + // Line for testing Riddle: return $req; // connect, send query, get response if (!( $fp = $this->_Connect() )) @@ -1564,11 +1564,11 @@ return false; } fclose ( $this->_socket ); $this->_socket = false; - + return true; } ////////////////////////////////////////////////////////////////////////// // status @@ -1604,11 +1604,11 @@ } $this->_MBPop (); return $res; } - + // Added for Riddle - code is taken from AddQuery function FilterOutput() { $req = ""; foreach ( $this->_filters as $filter ) @@ -1634,10 +1634,10 @@ default: assert ( 0 && "internal error: unhandled filter type" ); } $req .= pack ( "N", $filter["exclude"] ); } - + return $req; } } // \ No newline at end of file