jadell / neo4jphp

PHP wrapper of the Neo4j REST interface
Other
532 stars 137 forks source link

calling \Cypher\Query->getResultSet floods php logs #152

Closed ethrbunny closed 10 years ago

ethrbunny commented 10 years ago

(this is probably a config step that I've missed)

Attempts to get a count of results as follows:

 function getRowCount( $indexId )
{
    $client = connect();

    $query = "match (n:`index" . $indexId . "`) return n";
    $q = new Everyman\Neo4j\Cypher\Query( $client, $query );

    $ret = $q->getResultSet();

    return $ret->count();
}

This sends a large block of text to the PHP logs each time. Have attempted to suppress by changing log levels but haven't found the level that allows me to debug other code.

jadell commented 10 years ago

What do the logs say? Can you copy and paste them into a gist and link it here?

ethrbunny commented 10 years ago

https://gist.github.com/ethrbunny/c5a5b27cdc4c82afedad#file-gistfile1-txt

This is just a snip of what I'm seeing. As a reference:

$> wc php.log 26 114 55236 php.log

I cut out all but the last few lines(26) and ended up with a 55K file.

jadell commented 10 years ago

neo4jphp doesn't write any logs anywhere, nor does it do any type of output. The output in you log looks like print_r format of the HTTP response. Do you have a rogue print_r somewhere in your code?

Also, a better way to the row count would be:

function getRowCount( $indexId )
{
    $client = connect();

    $query = "match (n:`index" . $indexId . "`) return count(n) as count";
    $q = new Everyman\Neo4j\Cypher\Query( $client, $query );

    $ret = $q->getResultSet();

    return $ret[0]['count'];
}
ethrbunny commented 10 years ago

(sorry about the delay) - I will go back and dig out this offending bit. I suspected it was me from the start but I wanted to make sure.

Also - thanks for sending this code snip.

Jon

On Wed, Jul 2, 2014 at 11:32 AM, Josh Adell notifications@github.com wrote:

neo4jphp doesn't write any logs anywhere, nor does it do any type of output. The output in you log looks like print_r format of the HTTP response. Do you have a rogue print_r somewhere in your code?

Also, a better way to the row count would be:

function getRowCount( $indexId ){ $client = connect();

$query = "match (n:`index" . $indexId . "`) return count(n) as count";
$q = new Everyman\Neo4j\Cypher\Query( $client, $query );

$ret = $q->getResultSet();

return $ret[0]['count'];}

— Reply to this email directly or view it on GitHub https://github.com/jadell/neo4jphp/issues/152#issuecomment-47816549.