Changeset 2092 in ExiteCMS for trunk/includes/search/search.members.php
- Timestamp:
- 12/05/08 20:23:35 (3 years ago)
- File:
-
- 1 edited
-
trunk/includes/search/search.members.php (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/includes/search/search.members.php
r2090 r2092 19 19 if (eregi("search.members.php", $_SERVER['PHP_SELF']) || !defined('INIT_CMS_OK')) die(); 20 20 21 // array to store variables we want to use in the search template22 $reportvars = array();23 24 21 // make sure we have an action variable 25 22 if (isset($action)) { … … 29 26 // add the possible search filters ($data is defined in the calling script!) 30 27 $data['search_filters' ] = ""; 31 32 28 33 29 } else { … … 118 114 } 119 115 120 // check if we have a rowstart value121 if (!isset($rowstart)) $rowstart = 0;122 123 116 // check how many rows this would output 124 117 $rptresult = mysql_query($sql.($limit?" LIMIT $limit":"")); 125 $variables['rows'] = dbrows($rptresult); 126 if ($variables['rows']) { 127 $variables['rowstart'] = $rowstart; 128 $variables['items_per_page'] = $settings['numofthreads']; 118 $rows = dbrows($rptresult); 129 119 130 // now add a query limit, make sure not to overshoot the limit requested 131 if ($variables['rows']-$rowstart > $settings['numofthreads']) { 132 $sql .= " LIMIT ".$rowstart.",".$settings['numofthreads']; 133 } else { 134 $sql .= " LIMIT ".$rowstart.",".($variables['rows']-$rowstart); 135 } 136 $rptresult = dbquery($sql); 120 // are there any results? 121 if ($rows) { 137 122 138 // get the results if any 139 if ($variables['rows']) { 140 $reportvars['output'] = array(); 141 while ($rptdata = dbarray($rptresult)) { 142 $reportvars['output'][] = $rptdata; 123 // are we interested in these results? 124 if ($lines < $settings['numofthreads'] && $rowstart < $variables['rows'] + $rows) { 125 126 // add a query limit, we might not need all records 127 $sql .= " LIMIT ".(max($rowstart-$variables['rows'],0)).",".min($rows,($settings['numofthreads']-$lines)); 128 129 // launch the query 130 $rptresult = dbquery($sql); 131 132 // get the results if any 133 if ($rptresult) { 134 while ($rptdata = dbarray($rptresult)) { 135 $rptdata['_template'] = $data['template']; 136 $rptdata['download_description'] = parsemessage(array(), $rptdata['download_description'], true, true); 137 $reportvars['output'][] = $rptdata; 138 } 139 140 // get the score divider for this result set 141 $divider = 0; 142 foreach($reportvars['output'] as $key => $value) { 143 $divider = max($divider, $value['score']); 144 } 145 146 // calculate the relevance for this result set 147 foreach($reportvars['output'] as $key => $value) { 148 $reportvars['output'][$key]['relevance'] = $value['score'] / $divider * 100; 149 } 143 150 } 144 151 145 // get the score divider for this result set 146 $divider = 0; 147 foreach($reportvars['output'] as $key => $value) { 148 $divider = max($divider, $value['score']); 149 } 152 } 150 153 151 // calculate the relevance for this result set 152 foreach($reportvars['output'] as $key => $value) { 153 $reportvars['output'][$key]['relevance'] = $value['score'] / $divider * 100; 154 } 155 } 154 // add the amount of rows found to the total rows counter 155 $variables['rows'] += $rows; 156 156 157 } 158 157 159 } 158 160 }
Note: See TracChangeset
for help on using the changeset viewer.
