riddle 1.5.1 → 1.5.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/.travis.yml +2 -4
- data/HISTORY +13 -1
- data/README.textile +7 -1
- data/lib/riddle/0.9.9/client.rb +8 -8
- data/lib/riddle/auto_version.rb +2 -2
- data/lib/riddle/client.rb +6 -4
- data/lib/riddle/client/filter.rb +16 -11
- data/lib/riddle/client/response.rb +19 -19
- data/lib/riddle/query.rb +4 -1
- data/lib/riddle/version.rb +1 -1
- data/spec/fixtures/data/0.9.9/anchor.bin +0 -0
- data/spec/fixtures/data/0.9.9/any.bin +0 -0
- data/spec/fixtures/data/0.9.9/boolean.bin +0 -0
- data/spec/fixtures/data/0.9.9/comment.bin +0 -0
- data/spec/fixtures/data/0.9.9/distinct.bin +0 -0
- data/spec/fixtures/data/0.9.9/field_weights.bin +0 -0
- data/spec/fixtures/data/0.9.9/filter.bin +0 -0
- data/spec/fixtures/data/0.9.9/index.bin +0 -0
- data/spec/fixtures/data/0.9.9/index_weights.bin +0 -0
- data/spec/fixtures/data/0.9.9/overrides.bin +0 -0
- data/spec/fixtures/data/0.9.9/phrase.bin +0 -0
- data/spec/fixtures/data/0.9.9/rank_mode.bin +0 -0
- data/spec/fixtures/data/0.9.9/select.bin +0 -0
- data/spec/fixtures/data/0.9.9/simple.bin +0 -0
- data/spec/fixtures/data/0.9.9/sort.bin +0 -0
- data/spec/fixtures/data/0.9.9/weights.bin +0 -0
- data/spec/fixtures/data/1.10/anchor.bin +0 -0
- data/spec/fixtures/data/1.10/any.bin +0 -0
- data/spec/fixtures/data/1.10/boolean.bin +0 -0
- data/spec/fixtures/data/1.10/comment.bin +0 -0
- data/spec/fixtures/data/1.10/distinct.bin +0 -0
- data/spec/fixtures/data/1.10/field_weights.bin +0 -0
- data/spec/fixtures/data/1.10/filter.bin +0 -0
- data/spec/fixtures/data/1.10/index.bin +0 -0
- data/spec/fixtures/data/1.10/index_weights.bin +0 -0
- data/spec/fixtures/data/1.10/overrides.bin +0 -0
- data/spec/fixtures/data/1.10/phrase.bin +0 -0
- data/spec/fixtures/data/1.10/rank_mode.bin +0 -0
- data/spec/fixtures/data/1.10/select.bin +0 -0
- data/spec/fixtures/data/1.10/simple.bin +0 -0
- data/spec/fixtures/data/1.10/sort.bin +0 -0
- data/spec/fixtures/data/1.10/weights.bin +0 -0
- data/spec/fixtures/data/2.0.1/anchor.bin +0 -0
- data/spec/fixtures/data/2.0.1/any.bin +0 -0
- data/spec/fixtures/data/2.0.1/boolean.bin +0 -0
- data/spec/fixtures/data/2.0.1/comment.bin +0 -0
- data/spec/fixtures/data/2.0.1/distinct.bin +0 -0
- data/spec/fixtures/data/2.0.1/field_weights.bin +0 -0
- data/spec/fixtures/data/2.0.1/filter.bin +0 -0
- data/spec/fixtures/data/2.0.1/index.bin +0 -0
- data/spec/fixtures/data/2.0.1/index_weights.bin +0 -0
- data/spec/fixtures/data/2.0.1/overrides.bin +0 -0
- data/spec/fixtures/data/2.0.1/phrase.bin +0 -0
- data/spec/fixtures/data/2.0.1/rank_mode.bin +0 -0
- data/spec/fixtures/data/2.0.1/select.bin +0 -0
- data/spec/fixtures/data/2.0.1/simple.bin +0 -0
- data/spec/fixtures/data/2.0.1/sort.bin +0 -0
- data/spec/fixtures/data/2.0.1/weights.bin +0 -0
- data/spec/fixtures/data/2.1.0/anchor.bin +0 -0
- data/spec/fixtures/data/2.1.0/any.bin +0 -0
- data/spec/fixtures/data/2.1.0/boolean.bin +0 -0
- data/spec/fixtures/data/2.1.0/comment.bin +0 -0
- data/spec/fixtures/data/2.1.0/distinct.bin +0 -0
- data/spec/fixtures/data/2.1.0/field_weights.bin +0 -0
- data/spec/fixtures/data/2.1.0/filter.bin +0 -0
- data/spec/fixtures/data/2.1.0/index.bin +0 -0
- data/spec/fixtures/data/2.1.0/index_weights.bin +0 -0
- data/spec/fixtures/data/2.1.0/overrides.bin +0 -0
- data/spec/fixtures/data/2.1.0/phrase.bin +0 -0
- data/spec/fixtures/data/2.1.0/rank_mode.bin +0 -0
- data/spec/fixtures/data/2.1.0/select.bin +0 -0
- data/spec/fixtures/data/2.1.0/simple.bin +0 -0
- data/spec/fixtures/data/2.1.0/sort.bin +0 -0
- data/spec/fixtures/data/2.1.0/weights.bin +0 -0
- data/spec/fixtures/sphinxapi.0.9.8.php +8 -8
- data/spec/fixtures/sphinxapi.0.9.9.php +26 -26
- data/spec/fixtures/sphinxapi.1.10.php +27 -27
- data/spec/fixtures/sphinxapi.2.0.1.php +27 -27
- data/spec/fixtures/sphinxapi.2.1.0.php +2 -2
- data/spec/riddle/auto_version_spec.rb +14 -0
- data/spec/riddle/query_spec.rb +13 -8
- data/spec/unit/client_spec.rb +22 -0
- metadata +76 -49
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -212,7 +212,7 @@ class SphinxClient
|
|
|
212
212
|
$this->_filters = array ();
|
|
213
213
|
$this->_groupby = "";
|
|
214
214
|
$this->_groupfunc = SPH_GROUPBY_DAY;
|
|
215
|
-
$this->_groupsort = "@
|
|
215
|
+
$this->_groupsort = "@weight DESC";
|
|
216
216
|
$this->_groupdistinct= "";
|
|
217
217
|
$this->_maxmatches = 1000;
|
|
218
218
|
$this->_cutoff = 0;
|
|
@@ -603,7 +603,7 @@ class SphinxClient
|
|
|
603
603
|
{
|
|
604
604
|
$this->_groupby = "";
|
|
605
605
|
$this->_groupfunc = SPH_GROUPBY_DAY;
|
|
606
|
-
$this->_groupsort = "@
|
|
606
|
+
$this->_groupsort = "@weight DESC";
|
|
607
607
|
$this->_groupdistinct= "";
|
|
608
608
|
}
|
|
609
609
|
|
|
@@ -868,7 +868,7 @@ class SphinxClient
|
|
|
868
868
|
if ( $type==SPH_ATTR_FLOAT )
|
|
869
869
|
{
|
|
870
870
|
list(,$uval) = unpack ( "N*", substr ( $response, $p, 4 ) ); $p += 4;
|
|
871
|
-
list(,$fval) = unpack ( "f*", pack ( "L", $uval ) );
|
|
871
|
+
list(,$fval) = unpack ( "f*", pack ( "L", $uval ) );
|
|
872
872
|
$attrvals[$attr] = $fval;
|
|
873
873
|
continue;
|
|
874
874
|
}
|
|
@@ -1038,7 +1038,7 @@ class SphinxClient
|
|
|
1038
1038
|
|
|
1039
1039
|
// Commented out for testing Riddle
|
|
1040
1040
|
// $this->_MBPush ();
|
|
1041
|
-
//
|
|
1041
|
+
//
|
|
1042
1042
|
// if (!( $fp = $this->_Connect() ))
|
|
1043
1043
|
// {
|
|
1044
1044
|
// $this->_MBPop();
|
|
@@ -1053,7 +1053,7 @@ class SphinxClient
|
|
|
1053
1053
|
$req = pack ( "N", strlen($query) ) . $query; // req query
|
|
1054
1054
|
$req .= pack ( "N", strlen($index) ) . $index; // req index
|
|
1055
1055
|
$req .= pack ( "N", (int)$hits );
|
|
1056
|
-
|
|
1056
|
+
|
|
1057
1057
|
// Line for testing Riddle:
|
|
1058
1058
|
return $req;
|
|
1059
1059
|
|
|
@@ -1161,7 +1161,7 @@ class SphinxClient
|
|
|
1161
1161
|
|
|
1162
1162
|
// Line for testing Riddle:
|
|
1163
1163
|
return $req;
|
|
1164
|
-
|
|
1164
|
+
|
|
1165
1165
|
// mbstring workaround
|
|
1166
1166
|
$this->_MBPush ();
|
|
1167
1167
|
|
|
@@ -1187,7 +1187,7 @@ class SphinxClient
|
|
|
1187
1187
|
$this->_MBPop ();
|
|
1188
1188
|
return $updated;
|
|
1189
1189
|
}
|
|
1190
|
-
|
|
1190
|
+
|
|
1191
1191
|
// Function for Riddle, copied from internal code.
|
|
1192
1192
|
function FilterOutput()
|
|
1193
1193
|
{
|
|
@@ -1216,7 +1216,7 @@ class SphinxClient
|
|
|
1216
1216
|
}
|
|
1217
1217
|
$req .= pack ( "N", $filter["exclude"] );
|
|
1218
1218
|
}
|
|
1219
|
-
|
|
1219
|
+
|
|
1220
1220
|
return $req;
|
|
1221
1221
|
}
|
|
1222
1222
|
}
|
|
@@ -118,7 +118,7 @@ define ( "SPH_GROUPBY_ATTRPAIR", 5 );
|
|
|
118
118
|
function sphPackI64 ( $v )
|
|
119
119
|
{
|
|
120
120
|
assert ( is_numeric($v) );
|
|
121
|
-
|
|
121
|
+
|
|
122
122
|
// x64
|
|
123
123
|
if ( PHP_INT_SIZE>=8 )
|
|
124
124
|
{
|
|
@@ -130,7 +130,7 @@ function sphPackI64 ( $v )
|
|
|
130
130
|
if ( is_int($v) )
|
|
131
131
|
return pack ( "NN", $v < 0 ? -1 : 0, $v );
|
|
132
132
|
|
|
133
|
-
// x32, bcmath
|
|
133
|
+
// x32, bcmath
|
|
134
134
|
if ( function_exists("bcmul") )
|
|
135
135
|
{
|
|
136
136
|
if ( bccomp ( $v, 0 ) == -1 )
|
|
@@ -167,16 +167,16 @@ function sphPackI64 ( $v )
|
|
|
167
167
|
function sphPackU64 ( $v )
|
|
168
168
|
{
|
|
169
169
|
assert ( is_numeric($v) );
|
|
170
|
-
|
|
170
|
+
|
|
171
171
|
// x64
|
|
172
172
|
if ( PHP_INT_SIZE>=8 )
|
|
173
173
|
{
|
|
174
174
|
assert ( $v>=0 );
|
|
175
|
-
|
|
175
|
+
|
|
176
176
|
// x64, int
|
|
177
177
|
if ( is_int($v) )
|
|
178
178
|
return pack ( "NN", $v>>32, $v&0xFFFFFFFF );
|
|
179
|
-
|
|
179
|
+
|
|
180
180
|
// x64, bcmath
|
|
181
181
|
if ( function_exists("bcmul") )
|
|
182
182
|
{
|
|
@@ -184,12 +184,12 @@ function sphPackU64 ( $v )
|
|
|
184
184
|
$l = bcmod ( $v, 4294967296 );
|
|
185
185
|
return pack ( "NN", $h, $l );
|
|
186
186
|
}
|
|
187
|
-
|
|
187
|
+
|
|
188
188
|
// x64, no-bcmath
|
|
189
189
|
$p = max ( 0, strlen($v) - 13 );
|
|
190
190
|
$lo = (int)substr ( $v, $p );
|
|
191
191
|
$hi = (int)substr ( $v, 0, $p );
|
|
192
|
-
|
|
192
|
+
|
|
193
193
|
$m = $lo + $hi*1316134912;
|
|
194
194
|
$l = $m % 4294967296;
|
|
195
195
|
$h = $hi*2328 + (int)($m/4294967296);
|
|
@@ -200,7 +200,7 @@ function sphPackU64 ( $v )
|
|
|
200
200
|
// x32, int
|
|
201
201
|
if ( is_int($v) )
|
|
202
202
|
return pack ( "NN", 0, $v );
|
|
203
|
-
|
|
203
|
+
|
|
204
204
|
// x32, bcmath
|
|
205
205
|
if ( function_exists("bcmul") )
|
|
206
206
|
{
|
|
@@ -213,7 +213,7 @@ function sphPackU64 ( $v )
|
|
|
213
213
|
$p = max(0, strlen($v) - 13);
|
|
214
214
|
$lo = (float)substr($v, $p);
|
|
215
215
|
$hi = (float)substr($v, 0, $p);
|
|
216
|
-
|
|
216
|
+
|
|
217
217
|
$m = $lo + $hi*1316134912.0;
|
|
218
218
|
$q = floor($m / 4294967296.0);
|
|
219
219
|
$l = $m - ($q * 4294967296.0);
|
|
@@ -269,11 +269,11 @@ function sphUnpackU64 ( $v )
|
|
|
269
269
|
// x32, bcmath
|
|
270
270
|
if ( function_exists("bcmul") )
|
|
271
271
|
return bcadd ( $lo, bcmul ( $hi, "4294967296" ) );
|
|
272
|
-
|
|
272
|
+
|
|
273
273
|
// x32, no-bcmath
|
|
274
274
|
$hi = (float)$hi;
|
|
275
275
|
$lo = (float)$lo;
|
|
276
|
-
|
|
276
|
+
|
|
277
277
|
$q = floor($hi/10000000.0);
|
|
278
278
|
$r = $hi - $q*10000000.0;
|
|
279
279
|
$m = $lo + $r*4967296.0;
|
|
@@ -316,7 +316,7 @@ function sphUnpackI64 ( $v )
|
|
|
316
316
|
return $lo;
|
|
317
317
|
return sprintf ( "%.0f", $lo - 4294967296.0 );
|
|
318
318
|
}
|
|
319
|
-
|
|
319
|
+
|
|
320
320
|
$neg = "";
|
|
321
321
|
$c = 0;
|
|
322
322
|
if ( $hi<0 )
|
|
@@ -325,7 +325,7 @@ function sphUnpackI64 ( $v )
|
|
|
325
325
|
$lo = ~$lo;
|
|
326
326
|
$c = 1;
|
|
327
327
|
$neg = "-";
|
|
328
|
-
}
|
|
328
|
+
}
|
|
329
329
|
|
|
330
330
|
$hi = sprintf ( "%u", $hi );
|
|
331
331
|
$lo = sprintf ( "%u", $lo );
|
|
@@ -337,7 +337,7 @@ function sphUnpackI64 ( $v )
|
|
|
337
337
|
// x32, no-bcmath
|
|
338
338
|
$hi = (float)$hi;
|
|
339
339
|
$lo = (float)$lo;
|
|
340
|
-
|
|
340
|
+
|
|
341
341
|
$q = floor($hi/10000000.0);
|
|
342
342
|
$r = $hi - $q*10000000.0;
|
|
343
343
|
$m = $lo + $r*4967296.0;
|
|
@@ -417,7 +417,7 @@ class SphinxClient
|
|
|
417
417
|
$this->_filters = array ();
|
|
418
418
|
$this->_groupby = "";
|
|
419
419
|
$this->_groupfunc = SPH_GROUPBY_DAY;
|
|
420
|
-
$this->_groupsort = "@
|
|
420
|
+
$this->_groupsort = "@weight DESC";
|
|
421
421
|
$this->_groupdistinct= "";
|
|
422
422
|
$this->_maxmatches = 1000;
|
|
423
423
|
$this->_cutoff = 0;
|
|
@@ -479,7 +479,7 @@ class SphinxClient
|
|
|
479
479
|
$this->_path = $host;
|
|
480
480
|
return;
|
|
481
481
|
}
|
|
482
|
-
|
|
482
|
+
|
|
483
483
|
assert ( is_int($port) );
|
|
484
484
|
$this->_host = $host;
|
|
485
485
|
$this->_port = $port;
|
|
@@ -551,14 +551,14 @@ class SphinxClient
|
|
|
551
551
|
$fp = @fsockopen ( $host, $port, $errno, $errstr );
|
|
552
552
|
else
|
|
553
553
|
$fp = @fsockopen ( $host, $port, $errno, $errstr, $this->_timeout );
|
|
554
|
-
|
|
554
|
+
|
|
555
555
|
if ( !$fp )
|
|
556
556
|
{
|
|
557
557
|
if ( $this->_path )
|
|
558
558
|
$location = $this->_path;
|
|
559
559
|
else
|
|
560
560
|
$location = "{$this->_host}:{$this->_port}";
|
|
561
|
-
|
|
561
|
+
|
|
562
562
|
$errstr = trim ( $errstr );
|
|
563
563
|
$this->_error = "connection to $location failed (errno=$errno, msg=$errstr)";
|
|
564
564
|
$this->_connerror = true;
|
|
@@ -901,7 +901,7 @@ class SphinxClient
|
|
|
901
901
|
{
|
|
902
902
|
$this->_groupby = "";
|
|
903
903
|
$this->_groupfunc = SPH_GROUPBY_DAY;
|
|
904
|
-
$this->_groupsort = "@
|
|
904
|
+
$this->_groupsort = "@weight DESC";
|
|
905
905
|
$this->_groupdistinct= "";
|
|
906
906
|
}
|
|
907
907
|
|
|
@@ -1205,7 +1205,7 @@ class SphinxClient
|
|
|
1205
1205
|
if ( $type==SPH_ATTR_FLOAT )
|
|
1206
1206
|
{
|
|
1207
1207
|
list(,$uval) = unpack ( "N*", substr ( $response, $p, 4 ) ); $p += 4;
|
|
1208
|
-
list(,$fval) = unpack ( "f*", pack ( "L", $uval ) );
|
|
1208
|
+
list(,$fval) = unpack ( "f*", pack ( "L", $uval ) );
|
|
1209
1209
|
$attrvals[$attr] = $fval;
|
|
1210
1210
|
continue;
|
|
1211
1211
|
}
|
|
@@ -1375,7 +1375,7 @@ class SphinxClient
|
|
|
1375
1375
|
|
|
1376
1376
|
// Commented out for testing Riddle
|
|
1377
1377
|
// $this->_MBPush ();
|
|
1378
|
-
//
|
|
1378
|
+
//
|
|
1379
1379
|
// if (!( $fp = $this->_Connect() ))
|
|
1380
1380
|
// {
|
|
1381
1381
|
// $this->_MBPop();
|
|
@@ -1390,7 +1390,7 @@ class SphinxClient
|
|
|
1390
1390
|
$req = pack ( "N", strlen($query) ) . $query; // req query
|
|
1391
1391
|
$req .= pack ( "N", strlen($index) ) . $index; // req index
|
|
1392
1392
|
$req .= pack ( "N", (int)$hits );
|
|
1393
|
-
|
|
1393
|
+
|
|
1394
1394
|
// Line for testing Riddle:
|
|
1395
1395
|
return $req;
|
|
1396
1396
|
|
|
@@ -1512,7 +1512,7 @@ class SphinxClient
|
|
|
1512
1512
|
$req .= pack ( "N", $vv );
|
|
1513
1513
|
}
|
|
1514
1514
|
}
|
|
1515
|
-
|
|
1515
|
+
|
|
1516
1516
|
// Line for testing Riddle:
|
|
1517
1517
|
return $req;
|
|
1518
1518
|
|
|
@@ -1566,7 +1566,7 @@ class SphinxClient
|
|
|
1566
1566
|
|
|
1567
1567
|
fclose ( $this->_socket );
|
|
1568
1568
|
$this->_socket = false;
|
|
1569
|
-
|
|
1569
|
+
|
|
1570
1570
|
return true;
|
|
1571
1571
|
}
|
|
1572
1572
|
|
|
@@ -1606,7 +1606,7 @@ class SphinxClient
|
|
|
1606
1606
|
$this->_MBPop ();
|
|
1607
1607
|
return $res;
|
|
1608
1608
|
}
|
|
1609
|
-
|
|
1609
|
+
|
|
1610
1610
|
// Added for Riddle - code is taken from AddQuery
|
|
1611
1611
|
function FilterOutput()
|
|
1612
1612
|
{
|
|
@@ -1636,7 +1636,7 @@ class SphinxClient
|
|
|
1636
1636
|
}
|
|
1637
1637
|
$req .= pack ( "N", $filter["exclude"] );
|
|
1638
1638
|
}
|
|
1639
|
-
|
|
1639
|
+
|
|
1640
1640
|
return $req;
|
|
1641
1641
|
}
|
|
1642
1642
|
}
|
|
@@ -125,7 +125,7 @@ define ( "SPH_GROUPBY_ATTRPAIR", 5 );
|
|
|
125
125
|
function sphPackI64 ( $v )
|
|
126
126
|
{
|
|
127
127
|
assert ( is_numeric($v) );
|
|
128
|
-
|
|
128
|
+
|
|
129
129
|
// x64
|
|
130
130
|
if ( PHP_INT_SIZE>=8 )
|
|
131
131
|
{
|
|
@@ -137,7 +137,7 @@ function sphPackI64 ( $v )
|
|
|
137
137
|
if ( is_int($v) )
|
|
138
138
|
return pack ( "NN", $v < 0 ? -1 : 0, $v );
|
|
139
139
|
|
|
140
|
-
// x32, bcmath
|
|
140
|
+
// x32, bcmath
|
|
141
141
|
if ( function_exists("bcmul") )
|
|
142
142
|
{
|
|
143
143
|
if ( bccomp ( $v, 0 ) == -1 )
|
|
@@ -174,16 +174,16 @@ function sphPackI64 ( $v )
|
|
|
174
174
|
function sphPackU64 ( $v )
|
|
175
175
|
{
|
|
176
176
|
assert ( is_numeric($v) );
|
|
177
|
-
|
|
177
|
+
|
|
178
178
|
// x64
|
|
179
179
|
if ( PHP_INT_SIZE>=8 )
|
|
180
180
|
{
|
|
181
181
|
assert ( $v>=0 );
|
|
182
|
-
|
|
182
|
+
|
|
183
183
|
// x64, int
|
|
184
184
|
if ( is_int($v) )
|
|
185
185
|
return pack ( "NN", $v>>32, $v&0xFFFFFFFF );
|
|
186
|
-
|
|
186
|
+
|
|
187
187
|
// x64, bcmath
|
|
188
188
|
if ( function_exists("bcmul") )
|
|
189
189
|
{
|
|
@@ -191,12 +191,12 @@ function sphPackU64 ( $v )
|
|
|
191
191
|
$l = bcmod ( $v, 4294967296 );
|
|
192
192
|
return pack ( "NN", $h, $l );
|
|
193
193
|
}
|
|
194
|
-
|
|
194
|
+
|
|
195
195
|
// x64, no-bcmath
|
|
196
196
|
$p = max ( 0, strlen($v) - 13 );
|
|
197
197
|
$lo = (int)substr ( $v, $p );
|
|
198
198
|
$hi = (int)substr ( $v, 0, $p );
|
|
199
|
-
|
|
199
|
+
|
|
200
200
|
$m = $lo + $hi*1316134912;
|
|
201
201
|
$l = $m % 4294967296;
|
|
202
202
|
$h = $hi*2328 + (int)($m/4294967296);
|
|
@@ -207,7 +207,7 @@ function sphPackU64 ( $v )
|
|
|
207
207
|
// x32, int
|
|
208
208
|
if ( is_int($v) )
|
|
209
209
|
return pack ( "NN", 0, $v );
|
|
210
|
-
|
|
210
|
+
|
|
211
211
|
// x32, bcmath
|
|
212
212
|
if ( function_exists("bcmul") )
|
|
213
213
|
{
|
|
@@ -220,7 +220,7 @@ function sphPackU64 ( $v )
|
|
|
220
220
|
$p = max(0, strlen($v) - 13);
|
|
221
221
|
$lo = (float)substr($v, $p);
|
|
222
222
|
$hi = (float)substr($v, 0, $p);
|
|
223
|
-
|
|
223
|
+
|
|
224
224
|
$m = $lo + $hi*1316134912.0;
|
|
225
225
|
$q = floor($m / 4294967296.0);
|
|
226
226
|
$l = $m - ($q * 4294967296.0);
|
|
@@ -276,11 +276,11 @@ function sphUnpackU64 ( $v )
|
|
|
276
276
|
// x32, bcmath
|
|
277
277
|
if ( function_exists("bcmul") )
|
|
278
278
|
return bcadd ( $lo, bcmul ( $hi, "4294967296" ) );
|
|
279
|
-
|
|
279
|
+
|
|
280
280
|
// x32, no-bcmath
|
|
281
281
|
$hi = (float)$hi;
|
|
282
282
|
$lo = (float)$lo;
|
|
283
|
-
|
|
283
|
+
|
|
284
284
|
$q = floor($hi/10000000.0);
|
|
285
285
|
$r = $hi - $q*10000000.0;
|
|
286
286
|
$m = $lo + $r*4967296.0;
|
|
@@ -323,7 +323,7 @@ function sphUnpackI64 ( $v )
|
|
|
323
323
|
return $lo;
|
|
324
324
|
return sprintf ( "%.0f", $lo - 4294967296.0 );
|
|
325
325
|
}
|
|
326
|
-
|
|
326
|
+
|
|
327
327
|
$neg = "";
|
|
328
328
|
$c = 0;
|
|
329
329
|
if ( $hi<0 )
|
|
@@ -332,7 +332,7 @@ function sphUnpackI64 ( $v )
|
|
|
332
332
|
$lo = ~$lo;
|
|
333
333
|
$c = 1;
|
|
334
334
|
$neg = "-";
|
|
335
|
-
}
|
|
335
|
+
}
|
|
336
336
|
|
|
337
337
|
$hi = sprintf ( "%u", $hi );
|
|
338
338
|
$lo = sprintf ( "%u", $lo );
|
|
@@ -344,7 +344,7 @@ function sphUnpackI64 ( $v )
|
|
|
344
344
|
// x32, no-bcmath
|
|
345
345
|
$hi = (float)$hi;
|
|
346
346
|
$lo = (float)$lo;
|
|
347
|
-
|
|
347
|
+
|
|
348
348
|
$q = floor($hi/10000000.0);
|
|
349
349
|
$r = $hi - $q*10000000.0;
|
|
350
350
|
$m = $lo + $r*4967296.0;
|
|
@@ -445,7 +445,7 @@ class SphinxClient
|
|
|
445
445
|
$this->_filters = array ();
|
|
446
446
|
$this->_groupby = "";
|
|
447
447
|
$this->_groupfunc = SPH_GROUPBY_DAY;
|
|
448
|
-
$this->_groupsort = "@
|
|
448
|
+
$this->_groupsort = "@weight DESC";
|
|
449
449
|
$this->_groupdistinct= "";
|
|
450
450
|
$this->_maxmatches = 1000;
|
|
451
451
|
$this->_cutoff = 0;
|
|
@@ -507,7 +507,7 @@ class SphinxClient
|
|
|
507
507
|
$this->_path = $host;
|
|
508
508
|
return;
|
|
509
509
|
}
|
|
510
|
-
|
|
510
|
+
|
|
511
511
|
assert ( is_int($port) );
|
|
512
512
|
$this->_host = $host;
|
|
513
513
|
$this->_port = $port;
|
|
@@ -587,14 +587,14 @@ class SphinxClient
|
|
|
587
587
|
$fp = @fsockopen ( $host, $port, $errno, $errstr );
|
|
588
588
|
else
|
|
589
589
|
$fp = @fsockopen ( $host, $port, $errno, $errstr, $this->_timeout );
|
|
590
|
-
|
|
590
|
+
|
|
591
591
|
if ( !$fp )
|
|
592
592
|
{
|
|
593
593
|
if ( $this->_path )
|
|
594
594
|
$location = $this->_path;
|
|
595
595
|
else
|
|
596
596
|
$location = "{$this->_host}:{$this->_port}";
|
|
597
|
-
|
|
597
|
+
|
|
598
598
|
$errstr = trim ( $errstr );
|
|
599
599
|
$this->_error = "connection to $location failed (errno=$errno, msg=$errstr)";
|
|
600
600
|
$this->_connerror = true;
|
|
@@ -933,7 +933,7 @@ class SphinxClient
|
|
|
933
933
|
{
|
|
934
934
|
$this->_groupby = "";
|
|
935
935
|
$this->_groupfunc = SPH_GROUPBY_DAY;
|
|
936
|
-
$this->_groupsort = "@
|
|
936
|
+
$this->_groupsort = "@weight DESC";
|
|
937
937
|
$this->_groupdistinct= "";
|
|
938
938
|
}
|
|
939
939
|
|
|
@@ -1228,7 +1228,7 @@ class SphinxClient
|
|
|
1228
1228
|
if ( $type==SPH_ATTR_FLOAT )
|
|
1229
1229
|
{
|
|
1230
1230
|
list(,$uval) = unpack ( "N*", substr ( $response, $p, 4 ) ); $p += 4;
|
|
1231
|
-
list(,$fval) = unpack ( "f*", pack ( "L", $uval ) );
|
|
1231
|
+
list(,$fval) = unpack ( "f*", pack ( "L", $uval ) );
|
|
1232
1232
|
$attrvals[$attr] = $fval;
|
|
1233
1233
|
continue;
|
|
1234
1234
|
}
|
|
@@ -1247,7 +1247,7 @@ class SphinxClient
|
|
|
1247
1247
|
} else if ( $type==SPH_ATTR_STRING )
|
|
1248
1248
|
{
|
|
1249
1249
|
$attrvals[$attr] = substr ( $response, $p, $val );
|
|
1250
|
-
$p += $val;
|
|
1250
|
+
$p += $val;
|
|
1251
1251
|
} else
|
|
1252
1252
|
{
|
|
1253
1253
|
$attrvals[$attr] = sphFixUint($val);
|
|
@@ -1415,7 +1415,7 @@ class SphinxClient
|
|
|
1415
1415
|
|
|
1416
1416
|
// Commented out for testing Riddle
|
|
1417
1417
|
// $this->_MBPush ();
|
|
1418
|
-
//
|
|
1418
|
+
//
|
|
1419
1419
|
// if (!( $fp = $this->_Connect() ))
|
|
1420
1420
|
// {
|
|
1421
1421
|
// $this->_MBPop();
|
|
@@ -1430,7 +1430,7 @@ class SphinxClient
|
|
|
1430
1430
|
$req = pack ( "N", strlen($query) ) . $query; // req query
|
|
1431
1431
|
$req .= pack ( "N", strlen($index) ) . $index; // req index
|
|
1432
1432
|
$req .= pack ( "N", (int)$hits );
|
|
1433
|
-
|
|
1433
|
+
|
|
1434
1434
|
// Line for testing Riddle:
|
|
1435
1435
|
return $req;
|
|
1436
1436
|
|
|
@@ -1553,7 +1553,7 @@ class SphinxClient
|
|
|
1553
1553
|
$req .= pack ( "N", $vv );
|
|
1554
1554
|
}
|
|
1555
1555
|
}
|
|
1556
|
-
|
|
1556
|
+
|
|
1557
1557
|
// Line for testing Riddle:
|
|
1558
1558
|
return $req;
|
|
1559
1559
|
|
|
@@ -1617,7 +1617,7 @@ class SphinxClient
|
|
|
1617
1617
|
|
|
1618
1618
|
fclose ( $this->_socket );
|
|
1619
1619
|
$this->_socket = false;
|
|
1620
|
-
|
|
1620
|
+
|
|
1621
1621
|
return true;
|
|
1622
1622
|
}
|
|
1623
1623
|
|
|
@@ -1688,7 +1688,7 @@ class SphinxClient
|
|
|
1688
1688
|
$this->_MBPop ();
|
|
1689
1689
|
return $tag;
|
|
1690
1690
|
}
|
|
1691
|
-
|
|
1691
|
+
|
|
1692
1692
|
// Added for Riddle - code is taken from AddQuery
|
|
1693
1693
|
function FilterOutput()
|
|
1694
1694
|
{
|
|
@@ -1718,7 +1718,7 @@ class SphinxClient
|
|
|
1718
1718
|
}
|
|
1719
1719
|
$req .= pack ( "N", $filter["exclude"] );
|
|
1720
1720
|
}
|
|
1721
|
-
|
|
1721
|
+
|
|
1722
1722
|
return $req;
|
|
1723
1723
|
}
|
|
1724
1724
|
}
|