You'd have to get confirmation from Josh Adell on the details but I think that *getProperty* will be issuing a new HTTP call each time it is called. As you have this in a loop, that will be a lot of network traffic, causing the slowness you have observed.
For this kind of usage, you are best to look at batches and/or Cypher queries to minimise the amount of traffic to the server. Cheers Nigel On 27 January 2014 15:14, Rajat Singh <[email protected]> wrote: > Today i have written first basic program for Neo4j from PHP. This was > basically done to check out if we could use Neo4j in our new project from > PHP by using Neo4jPhp. https://github.com/jadell/neo4jphp > > here is my code > > <!DOCTYPE html><html><body> > <h1>My first PHP page</h1> > <?php > > include 'neo4jphp.phar'; > echo "Hello World!"; > // Connecting to the default port 7474 on localhost > $client = new Everyman\Neo4j\Client(); > $queryString = > "MATCH (n)". > "RETURN n"; > $query = new Everyman\Neo4j\Cypher\Query($client, $queryString); > $result = $query->getResultSet(); > > foreach ($result as $row) { > echo $row['n']->getProperty('name') . "\n";} > ?> > </body></html> > > Now here i am just retrieving all the nodes with their property. Pretty > simple. > > if i run this from graphical console of Neo4j, it takes 86 ms. I have only > 200 nodes and almost same property. > > match (n)return n > > Returned 50 rows in 86 ms > > If i run this from above PHP file, it takes 2-4 seconds in total to dump > data in browser. Neo4j is running in same machine. > > Please note that i have not done any changes in the configuration of both > PHP and Neo4j. Everything is default. Please tell me if this is the > expected behaviour of Neo4j with PHP or something is really wrong with my > code or configuration. > > Thanks a lot > > -- > You received this message because you are subscribed to the Google Groups > "Neo4j" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > For more options, visit https://groups.google.com/groups/opt_out. > -- You received this message because you are subscribed to the Google Groups "Neo4j" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/groups/opt_out.
