![]() |
Xataface 2.0
Xataface Application Framework
|
00001 <?php 00002 class dataface_actions_search_index { 00003 00004 function handle(&$params){ 00005 import('Dataface/Index.php'); 00006 $app =& Dataface_Application::getInstance(); 00007 $q = $app->getQuery(); 00008 if ( @$q['table'] ) $q['-table'] = $q['table']; 00009 else unset($q['-table']); 00010 00011 $index = new Dataface_Index(); 00012 $res = $index->find($q, true); 00013 00014 $results =& $res['results']; 00015 00016 foreach ($results as $id=>$result){ 00017 $width = intval((floatval($result['relevance'])/10.0)*30.0); 00018 $results[$id]['relevance_bar'] = '<div style="border:1px solid #ccc; padding:1px margin:1px; background-color: #eaeaea; width:32px; height: 5px;"><div style="border: none; background-color: green; width: '.$width.'px; height:5px;"></div></div>'; 00019 } 00020 00021 00022 df_display(array('results'=>&$results, 'metadata'=>&$res['metadata'], 'search_term'=>$q['-search']), 'Dataface_Search_Results.html'); 00023 } 00024 00025 }