Xataface
2.0alpha2
Xataface Application Framework
Main Page
Related Pages
Modules
Namespaces
Data Structures
Files
Examples
File List
Globals
All
Data Structures
Namespaces
Files
Functions
Variables
Groups
Pages
actions
search_index.php
Go to the documentation of this file.
1
<?php
2
class
dataface_actions_search_index
{
3
4
function
handle
(&$params){
5
import
(
'Dataface/Index.php'
);
6
$app
=&
Dataface_Application::getInstance
();
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
}
Generated on Fri Mar 22 2013 09:40:33 for Xataface by
1.8.1.2