php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #62819 PHP client does not return sql_attr_string type
Submitted: 2012-08-14 15:42 UTC Modified: 2013-02-18 00:35 UTC
From: mrdgardiner at gmail dot com Assigned: tony2001 (profile)
Status: No Feedback Package: sphinx (PECL)
PHP Version: 5.3.15 OS: Red Hat 4.4.6-3
Private report: No CVE-ID: None
 [2012-08-14 15:42 UTC] mrdgardiner at gmail dot com
Description:
------------
It appears that Sphinx does not return string attributes using the PHP 1.2.0-1 Sphinx client with Sphinx sphinx-2.0.4-1.

Test:

1. setup and install sphinx.
2. Next create a sphinx config with the below details
3. Next using indexer index "phptest" (/usr/local/bin/indexer phptest)
4. Next install PHP 5.3.15
5. Next install Sphinx PHP 1.2.0-1
6. Next libsphinxclient-2.0.4-1
7. Next compile the test php script and execute the test.



Test script:
---------------
Sphinx Config:

source xmlpipe_source
{
    type = xmlpipe2
    xmlpipe_command = cat /var/tmp/document1
}

index phptest
{
        source                  = xmlpipe_source
        path                    = /var/data/documents
        docinfo                 = extern
        charset_type            = utf-8
}


Test Documents:

/var/tmp/document1

<?xml version="1.0" encoding="utf-8"?>
<sphinx:docset>
<sphinx:schema>
<sphinx:attr name="subject" type="string"/>
<sphinx:field name="content"/>
<sphinx:attr name="published" type="timestamp"/>

</sphinx:schema>

<sphinx:document id="9999">
<content>show me the string</content>
<published>1012325463</published>
<subject>This is the subject</subject>
</sphinx:document>

<sphinx:document id="1235">
<subject>another subject</subject>
<content>here comes another document, and i am given to understand,
that in-document field order must not matter, sir</content>
<published>1012325467</published>
</sphinx:document>

</sphinx:docset>


PHP Test:

php -f test.php


Code:

<?php
  $cl = new SphinxClient();
  $cl->SetServer( "localhost", 9312 );
  $cl->SetMatchMode( SPH_MATCH_ALL  );

  $result = $cl->Query( 'show me the string', 'phptest' );

  if ( $result === false ) {
      echo "Query failed: " . $cl->GetLastError() . ".\n";
  }
  else {
      if ( $cl->GetLastWarning() ) {
          echo "WARNING: " . $cl->GetLastWarning() . "
";
      }

      if ( ! empty($result["matches"]) ) {
          foreach ( $result["matches"] as $doc => $docinfo ) {
                echo "$doc\n";
          }

          print_r( $result );
      }
  }

  exit;
?>




Expected result:
----------------
[matches] => Array
        (
            [9999] => Array
                (
                    [weight] => 4
                    [attrs] => Array
                        (
                            [subject] => 'This is the subject'
                            [published] => 1012325463
                        )

                )

        )

Actual result:
--------------
[matches] => Array
        (
            [9999] => Array
                (
                    [weight] => 4
                    [attrs] => Array
                        (
                            [subject] => 156595442
                            [published] => 1012325463
                        )

                )

        )

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2012-08-14 16:10 UTC] mrdgardiner at gmail dot com
Also tested on X86_64 platform showing defect as well.
 [2012-08-14 16:29 UTC] tony2001@php.net
-Status: Open +Status: Feedback
 [2012-08-14 16:29 UTC] tony2001@php.net
Show me the output of Sphinx's extension configure pls.
 [2012-08-14 16:29 UTC] tony2001@php.net
-Assigned To: +Assigned To: tony2001
 [2012-12-14 09:02 UTC] tony2001@php.net
-Status: Feedback +Status: No Feedback
 [2012-12-14 20:24 UTC] mrdgardiner at gmail dot com
What specific details would you like to see for the extensions?

command?
 [2012-12-15 11:07 UTC] tony2001@php.net
-Status: No Feedback +Status: Feedback
 [2012-12-15 11:07 UTC] tony2001@php.net
sql_attr_string is present in libsphinxclient >= 1.1.0
If you don't see it in your output, then your extension is compiled with older client 
library.
To support this supposition I'm asking you tou show me the output of your ./configure 
command for Sphinx extension, since the client library version is detected during 
configure time.
 [2013-02-18 00:35 UTC] pecl-dev at lists dot php dot net
No feedback was provided. The bug is being suspended because
we assume that you are no longer experiencing the problem.
If this is not the case and you are able to provide the
information that was requested earlier, please do so and
change the status of the bug back to "Open". Thank you.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Dec 21 14:01:32 2024 UTC