public static function userCanSearch($u, $q)
 {
     $q = ProfileNdx_search_engine::mysql_escape_mimic_fromPhpDoc($q);
     $dbc = XenForo_Application::get('db');
     $qry = "SELECT COUNT(u) AS times, MAX(d) AS lastrq FROM `kiror_profile_search_limiting` WHERE u=" . $u . " GROUP BY u;";
     $r = $dbc->fetchRow($qry);
     $qry = "SELECT d FROM `kiror_profile_search_cache` WHERE q='" . $q . "' LIMIT 1;";
     $available = $dbc->fetchRow($qry)['d'] != null;
     $acc = time();
     $xfopt = XenForo_Application::get('options');
     $searchblocktime = $xfopt->searchblocktime;
     $waittime = $searchblocktime - ($acc - $r['lastrq']);
     if ($available || $waittime <= 0) {
         ProfileNdx_search_engine::computeSearchRequest($q);
         return array('status' => true, 'wait' => 0);
     }
     return array('status' => false, 'wait' => $waittime);
 }