To do

"; $star_img = "\"mark"; // this could use some Javascript effect $alt_img = "\"use"; $bug_img = "\"mark"; 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"]); // note that $IDs = array_unique(array_keys($res["matches"])); does not solve the multiple page issue // thus probably comes from a duplicate indexing print "

Query$bug_img

"; if (isset( $res["words"]["$words"]["hits"]) ) $hits = $res["words"]["$words"]["hits"]." time(s) "; else $hits = ""; print "\"$words\" found ".$hits." 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).
"; } ?>