Last active
August 29, 2015 14:05
-
-
Save do-aki/419953a481d0289ffbbb to your computer and use it in GitHub Desktop.
use groonga with nise-nabe/groonga-http-php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
require __DIR__ . '/vendor/autoload.php'; | |
use Groonga\Http\Client; | |
$grn = new Client('http://localhost:10041'); | |
$grn->tableCreate('Site', ['flags' => 'TABLE_HASH_KEY','key_type' => 'ShortText']); | |
$grn->columnCreate('Site', 'title', 'COLUMN_SCALAR', 'ShortText'); | |
$grn->load('Site', json_encode([ | |
["_key" => "http://example.org/","title" => "This is test record 1!"], | |
["_key" => "http://example.net/","title" => "test record 2."], | |
])); | |
$r = $grn->select('Site', ['query' => '_id:1']); | |
var_dump($r); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
array(2) { | |
[0] => array(3) { | |
[0] => int(0) | |
[1] => double(1409552209.2692) | |
[2] => double(0.0011940002441406) | |
} | |
[1] => array(1) { | |
[0] => array(3) { | |
[0] => array(1) { | |
[0] => int(1) | |
} | |
[1] => array(3) { | |
[0] => array(2) { | |
[0] => string(3) "_id" | |
[1] => string(6) "UInt32" | |
} | |
[1] => array(2) { | |
[0] => string(4) "_key" | |
[1] => string(9) "ShortText" | |
} | |
[2] => array(2) { | |
[0] => string(5) "title" | |
[1] => string(9) "ShortText" | |
} | |
} | |
[2] => array(3) { | |
[0] => int(1) | |
[1] => string(19) "http://example.org/" | |
[2] => string(22) "This is test record 1!" | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment