Beispiel #1
0
        $this->num = 0;
    }
}
// main
$searcher = new Searcher();
$input = new Input();
$output = null;
$count = 0;
try {
    $searcher->setInput($input);
    $db = OnyokuDB::getInstance();
    if ($count = $searcher->count($db)) {
        // ヒットした件数
        $searcher->search($db);
    }
    $output = $searcher->export();
} catch (Exception $e) {
    $error_message = $e->getMessage();
}
$result['results'] = $count;
if ($output) {
    $tmp = json_decode($output, true);
    for ($i = 0; $i < $count; $i++) {
        $a['name'] = $tmp['data'][$i][0];
        if ($input->mode == 'artist' || $input->mode == 'label') {
            $a['kana'] = $tmp['data'][$i][1];
            $a['id'] = $tmp['data'][$i][2];
        } else {
            if ($input->mode == 'category' || $input->mode == 'music' || $input->mode == 'disc_type') {
                $a['id'] = $tmp['data'][$i][1];
            } else {