Beispiel #1
0
 $searcher->setMatchMode(SPH_MATCH_ALL);
 $searcher->setSortMode(SPH_SORT_RELEVANCE);
 $searcher->setMaxQueryTime(3000);
 $min = ($page - 1) * RPP;
 $max = $min + RPP;
 //max+1
 $out_array = array();
 //TTHS
 $prev_instanses_count = 0;
 $start = max(0, $min - $prev_instanses_count);
 $len = min(RPP, max(1, $max - $prev_instanses_count));
 $searcher->setLimits($start, $len);
 $tths_result = $searcher->query($query, "dc_tths dc_tths_delta");
 $total_tths = $tths_result['total'];
 if ($total_tths && is_array($tths_result['matches']) && count($out_array) < RPP) {
     $tths = Searcher::getTTHs(array_keys($tths_result['matches']));
     $out_array = array_merge($out_array, $tths);
 }
 if (!$nodirs) {
     //DIRS
     if ($days) {
         $searcher->SetFilterRange("starttime", 0, time() - $days * 24 * 60 * 60, true);
         //exclude too old results
     }
     $prev_instanses_count += $total_tths;
     $start = max(0, $min - $prev_instanses_count);
     $len = min(RPP, max(1, $max - $prev_instanses_count));
     $searcher->setLimits($start, $len);
     $dirs_result = $searcher->query($query, "dc_dirs dc_dirs_delta");
     $total_dirs = $dirs_result['total'];
     if ($total_dirs && is_array($dirs_result['matches']) && count($out_array) < RPP) {