/** 查询一共有多少条符合条件的记录. */ function psearch_count($keyword) { $key = "psearch.count.{$keyword}"; global $rpc_client; if (empty($rpc_client)) { $rpc_client = new PHPRPC_Client(); $rpc_client->setProxy(NULL); $rpc_client->useService(SCH_API); } $ret = $rpc_client->search_result_report(SCH_DB, $keyword); if (array_key_exists("Number", $ret)) { error_log("error occured when search keyword:{$keyword},api:" . SCH_API . ",db:" . SCH_DB); return 0; } else { //set_memcache_data($memcache,$key,$ret["matches_lower_bound"],4*3600); return intval($ret["matches_lower_bound"]); } }