<?php include('../../classes/sphinxapi.php'); include('../../classes/class.database.php'); require('../../conf/fonctions.php'); $debutpage=temps(); $db = new database(); $cl = new SphinxClient(); $cl->SetArrayResult(true); $cl->SetMatchMode(SPH_MATCH_ALL); /* In SPH_SORT_EXTENDED mode, you can specify an SQL-like sort expression with up to 5 attributes (including internal attributes), eg: @relevance DESC, price ASC, @id DESC Both internal attributes (that are computed by the engine on the fly) and user attributes that were configured for this index are allowed. Internal attribute names must start with magic @-symbol; user attribute names can be used as is. In the example above, @relevance and @id are internal attributes and price is user-specified. Known internal attributes are: @id (match ID) @weight (match weight) @rank (match weight) @relevance (match weight) @random (return results in random order) */ // PARAGRAPHE DE SWITCH DU TRI : if(isset($_GET['tri'])){ $tri=$_GET['tri']; }else{ $tri=''; } if(isset($_GET['order'])){ $order=$_GET['order']; }else{ $order=''; } switch($tri){ case 'annee': switch($order){ case 'DESC': $cl->SetSortMode(SPH_SORT_ATTR_DESC,'Film_Annee_Production'); break; default: case 'ASC': $cl->SetSortMode(SPH_SORT_ATTR_ASC,'Film_Annee_Production'); break; } break; default: case 'titre': switch($order){ case 'DESC': $cl->SetSortMode(SPH_SORT_ATTR_DESC,'titre_ordinal'); break; default: case 'ASC': $cl->SetSortMode(SPH_SORT_ATTR_ASC,'titre_ordinal'); break; } break; } // PARAGRAPHE LIMITES : if(isset($_GET['limite'])){ $limite=$_GET['limite']; }else{ $limite=0; } $cl->SetLimits($limite,100); $q=$_GET['q']; $res = $cl->Query($q,'film'); if($res===false){ echo "Query failed: " . $cl->GetLastError() . ".\n"; }else{ if($cl->GetLastWarning()){ echo "WARNING: " . $cl->GetLastWarning() . ""; } print "Query '$q' retrieved $res[total] of $res[total_found] matches in $res[time] sec.<br>"; print "Query stats:<br>"; if(is_array($res["words"])){ foreach ( $res["words"] as $word => $info ){ print " '$word' found $info[hits] times in $info[docs] documents<br>"; } print "<br>"; } if ( is_array($res["matches"]) ) { $n = 1; print "Matches:<br>"; foreach ( $res["matches"] as $docinfo ){ print "$n. doc_id = $docinfo[id], weight = $docinfo[weight]"; $res_sql=$db->query("SELECT Film_titre,Film_Annee_Production from film where film_id=$docinfo[id]"); print ' <b>'.$res_sql[0]['Film_titre']; if($res_sql[0]['Film_Annee_Production']!=''){ print ' ('.$res_sql[0]['Film_Annee_Production'].')'; } print "</b><br>"; $n++; } } } $finpage=temps(); $totalpage=$finpage-$debutpage; $totalpage=substr($totalpage,0,5); echo 'Page générée en '.$totalpage.' secondes, '; ?>
Action unknown: copypageplugin__copy