Xataface  2.0alpha2
Xataface Application Framework
 All Data Structures Namespaces Files Functions Variables Groups Pages
search_index.php
Go to the documentation of this file.
1 <?php
3 
4  function handle(&$params){
5  import('Dataface/Index.php');
7  $q = $app->getQuery();
8  if ( @$q['table'] ) $q['-table'] = $q['table'];
9  else unset($q['-table']);
10 
11  $index = new Dataface_Index();
12  $res = $index->find($q, true);
13 
14  $results =& $res['results'];
15 
16  foreach ($results as $id=>$result){
17  $width = intval((floatval($result['relevance'])/10.0)*30.0);
18  $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>';
19  }
20 
21 
22  df_display(array('results'=>&$results, 'metadata'=>&$res['metadata'], 'search_term'=>$q['-search']), 'Dataface_Search_Results.html');
23  }
24 
25 }