View Issue Details Jump to Notes ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0001096Sphinxsphinxsepublic2012-02-15 16:222012-10-12 08:23
Reporterkworr 
Assigned Tokevg 
PrioritynormalSeveritymajorReproducibilityalways
StatusclosedResolutionfixed 
Platformamd64OSFreeBSDOS Version9.0
Product Version2.0.2-beta 
Target VersionFixed in Version 
Summary0001096: grouping search produces garbage
DescriptionI have this small sample of code:

<?php

include "/usr/local/share/examples/sphinxsearch/api/sphinxapi.php";

$sx = new SphinxClient;
$sx->setServer('/var/run/sphinxsearch/searchd.socket');
$sx->setSelect('group_field, @count');
$sx->setGroupBy("group_field", SPH_GROUPBY_ATTR, '@count desc');

$result = $sx->query('', 'big_index');

if ($result != false) {
  var_dump($result);
} else {
  echo $sx->getLastWarning();
  echo $sx->getLastError();
}

?>

On my index running this file results in:

array(9) {
  ["error"]=>
  string(0) ""
  ["warning"]=>
  string(0) ""
  ["status"]=>
  int(0)
  ["fields"]=>
  array(1) {
    [0]=>
    string(5) "title"
  }
  ["attrs"]=>
  array(3) {
    ["group_field"]=>
    int(7)
    ["@count"]=>
    int(1)
    ["@groupby"]=>
    int(6)
  }
  ["matches"]=>
  array(4) {
    [14]=>
    array(2) {
      ["weight"]=>
      string(1) "1"
      ["attrs"]=>
      array(3) {
        ["group_field"]=>
        string(2) "aa"
        ["@count"]=>
        int(103337)
        ["@groupby"]=>
        int(-5937189547123160818)
      }
    }
    [443829035466752]=>
    array(2) {
      ["weight"]=>
      string(2) "42"
      ["attrs"]=>
      array(3) {
        ["group_field"]=>
# hey! I have no empty `group_field`s in my index, all of them are string(2)
        string(1) ""
        ["@count"]=>
        int(624)
        ["@groupby"]=>
        int(7061645262979536930)
      }
    }
    ["18422004148179304691"]=>
    array(2) {
      ["weight"]=>
      string(10) "3573547008"
      ["attrs"]=>
      array(3) {
        ["group_field"]=>
        string(0) ""
        ["@count"]=>
        int(67108864)
        ["@groupby"]=>
        int(72057594078850048)
      }
    }
    [56625909913555028]=>
    array(2) {
      ["weight"]=>
      string(10) "2258917632"
      ["attrs"]=>
      array(3) {
        ["group_field"]=>
hoAfrau string(593) "+roVhTިes̀9�Mtr�i=��C�i2bg��46!|P�pt���S4���Gsr�}ya���Ics~!5�~elq���$OqThuogx
       ���
Dfi1��|[wv[:1�==A"1:�TBnlO�PH��O�fscH$�"�i?�H$.heG>^8���G>,slB_uD8arC
        ["@count"]=>
        NULL
        ["@groupby"]=>
        int(0)
      }
    }
  }
  ["total"]=>
  string(1) "0"
  ["total_found"]=>
  string(1) "0"
  ["time"]=>
  string(5) "0.000"
}
TagsNo tags attached.
Attached Files

- Relationships
duplicate of 0001058closedTomat Corrupt results with Distributed RT index queries via SphinxAPI 

-  Notes
(0002560)
kworr (reporter)
2012-02-15 16:38

The following code works though:

import sys

sys.path.append('/usr/local/share/examples/sphinxsearch/api')

import sphinxapi

sx = sphinxapi.SphinxClient()
sx.SetServer('/var/run/sphinxsearch/searchd.socket')
sx.SetSelect('group_field, @count');
sx.SetGroupBy("group_field", sphinxapi.SPH_GROUPBY_ATTR, '@count desc');

result = sx.Query('', 'my_index');

if result:
  print(repr(result))
else:
  for bad_result in (sx.GetLastWarning(), sx.GetLastError()):
    if bad_result:
      print(bad_result)
(0002561)
kworr (reporter)
2012-02-15 16:45

This seems to be related to PHP unpacking code. My PHP version is:

PHP 5.3.10 with Suhosin-Patch (cli) (built: Feb 15 2012 11:52:48)
Copyright (c) 1997-2012 The PHP Group
Zend Engine v2.3.0, Copyright (c) 1998-2012 Zend Technologies
    with XCache v1.3.2, Copyright (c) 2005-2011, by mOo
    with Suhosin v0.9.33, Copyright (c) 2007-2012, by SektionEins GmbH
(0002562)
Tomat (manager)
2012-02-15 19:10

could you try to use searchd compat=1 option?
(0002563)
kworr (reporter)
2012-02-15 19:47

Did you mean "compat_sphinxql_magics = 1"? Yes, that fixes the problem.

- Issue History
Date Modified Username Field Change
2012-02-15 16:22 kworr New Issue
2012-02-15 16:38 kworr Note Added: 0002560
2012-02-15 16:45 kworr Note Added: 0002561
2012-02-15 19:09 Tomat Relationship added duplicate of 0001058
2012-02-15 19:10 Tomat Note Added: 0002562
2012-02-15 19:47 kworr Note Added: 0002563
2012-10-12 08:23 kevg Status new => closed
2012-10-12 08:23 kevg Assigned To => kevg
2012-10-12 08:23 kevg Resolution open => fixed


Copyright © 2000 - 2010 MantisBT Group
Powered by Mantis Bugtracker