To do

"; $star_img = ""; $alt_img = ""; $bug_img = ""; if ($words == ""){ print "You need to make an actual search, use ?query=keyword
"; print "

"; return; } if ($startingitem == "" || $startingitem < 0){ $startingitem=0; } $itemspan=20; $cl = new SphinxClient (); $cl->SetLimits($startingitem, $startingitem+$itemspan); $cl->SetMatchMode(SPH_MATCH_EXTENDED2); $cl->SetRankingMode(SPH_RANK_PROXIMITY_BM25); # consider other ranking e.g. pagerank, weighted with freshness and hybrid $cl->SetSortMode(SPH_SORT_RELEVANCE); $res = $cl->Query($words,$index); #cf http://sphinxsearch.com/docs/manual-2.0.1.html#api-funcgroup-querying #$res = $cl->BuildExcerpts ( $docs, $index, $words, $opts ); if ( !$res ) { die ( "ERROR: " . $cl->GetLastError() . ".\n" ); } else { // XXX should test for empty result before doing the assigment // if (0 results) { $socialsearch = shell_exec("pmwiki_social_search "$keyword"); } // ideally this would be done ascynhroneously as it does take some time (few seconds!) // yet still always offer it as an option (since it's "costly") #var_dump($res); $IDs = array_keys($res["matches"]); print "

Query$bug_img

"; print "\"$words\" found ".$res["words"]["$words"]["hits"]." time(s) in ".$res["total_found"]." document(s):
"; print ""; print "
"; if ($previousitems >= 0) print "previous items"; for ($p=1;$p<$res["total"]/$itemspan;$p++) print " $p/"; if ($nextitems < $res["total"]) print "next items"; print "
"; $indexage = "unknown"; $targetindexfile = "/var/lib/sphinxsearch/data/pmwikis.spd"; $updatedindex = filemtime($targetindexfile); $indexage = date("c",$updatedindex); print "
$indexage index
(if bug check indexer errors).
"; } ?>