php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #67708 bug in retrieving "sql_field_string"
Submitted: 2014-07-29 12:20 UTC Modified: -
Votes:2
Avg. Score:4.5 ± 0.5
Reproduced:2 of 2 (100.0%)
Same Version:0 (0.0%)
Same OS:1 (50.0%)
From: anas1305 at gmail dot com Assigned:
Status: Open Package: sphinx (PECL)
PHP Version: Irrelevant OS: Windows 7
Private report: No CVE-ID: None
Have you experienced this issue?
Rate the importance of this bug to you:

 [2014-07-29 12:20 UTC] anas1305 at gmail dot com
Description:
------------
The "sql_field_string" defined in "sphinx.conf" does not return the expected string but return a number instead. But it work if I use "search.exe" tool in cli mode or the "sphinxapi.php" provided in sphinx package.

Used Versions :
- PHP : 5.4.16 (Wampserver 2.4)
- sphinx : Sphinx 2.1.9-release (r4761)
- pecl sphinx : 1.3.2 & 1.3.1 (5.4 Thread Safe (TS) x86)

Test script:
---------------
- In "sphinx.conf" :

source documents : base 
{
   ....
   sql_query 	    = SELECT `id`, `title` FROM `documents`
   sql_field_string = title
}

index documents 
{
  source = documents
  path = C:\Sphinx\var\data\documents
  dict = keywords
  min_infix_len = 3
  charset_type = utf-8
}

-> I use the "example.sql" in the sphinx package. 

// In "sphinx_test.php" :

$s = new SphinxClient();
$s->setServer("localhost", 9312);
$result = $s->query('test', 'documents');
print_r($result);

Expected result:
----------------
Array
(
    [error] => 
    [warning] => 
    [status] => 0
    [fields] => Array
        (
            [0] => title
        )

    [attrs] => Array
        (
            [title] => 7
        )

    [matches] => Array
        (
            [1] => Array
                (
                    [weight] => 1
                    [attrs] => Array
                        (
                            [title] => test one    <------ this one
                        )

                )

            [2] => Array
                (
                    [weight] => 1
                    [attrs] => Array
                        (
                            [title] => test two     <------ this one
                        )

                )

        )

    [total] => 2
    [total_found] => 2
    [time] => 0.015
    [words] => Array
        (
            [test] => Array
                (
                    [docs] => 2
                    [hits] => 2
                )

        )

)


Actual result:
--------------
Array
(
    [error] => 
    [warning] => 
    [status] => 0
    [fields] => Array
        (
            [0] => title
        )

    [attrs] => Array
        (
            [title] => 7
        )

    [matches] => Array
        (
            [1] => Array
                (
                    [weight] => 1
                    [attrs] => Array
                        (
                            [title] => 46017541   <--------
                        )

                )

            [2] => Array
                (
                    [weight] => 1
                    [attrs] => Array
                        (
                            [title] => 46017561 <-------------
                        )

                )

        )

    [total] => 2
    [total_found] => 2
    [time] => 0
    [words] => Array
        (
            [test] => Array
                (
                    [docs] => 2
                    [hits] => 2
                )

        )

)

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2015-07-17 14:44 UTC] cheung dot jackey at gmail dot com
PHP 5.3.29
Windows 7 x64
Sphinx 2.2.9-release
PECL sphinx 1.3.3

Same issue occurs
 
PHP Copyright © 2001-2017 The PHP Group
All rights reserved.
Last updated: Sun Nov 19 01:31:42 2017 UTC