Index: luceneapi.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/luceneapi/luceneapi.module,v
retrieving revision 1.61.2.121
diff -r1.61.2.121 luceneapi.module
507a508,513
>   if (!isset($a['weight'])) {
>     $a['weight'] = 0;
>   }
>   if (!isset($b['weight'])) {
>     $b['weight'] = 0;
>   }
925a932,944
>  * Implementation of hook_luceneapi_sortable_fields().
>  */
> function luceneapi_luceneapi_sortable_fields($module, $type = NULL) {
>   return array(
>     'score' => array(
>       'title' => t('Relevance'),
>       'type' => NULL,
>       'weight' => -10,
>     ),
>   );
> }
> 
> /**
930c949
<  *   An array containing the module handling the search.
---
>  *   A string containing the module handling the search.
941a961
>     uasort($fields[$module], 'luceneapi_weight_sort');
946a967,1014
>  * Returns a list of themed sort links based on what was passed through the
>  * query string.
>  *
>  * @param $module
>  *   A string containing the module handling the search.
>  * @return
>  *   An array of themed sort links.
>  * @see luceneapi_sortable_fields_get()
>  */
> function luceneapi_sort_links_get($module) {
>   // builds array of sort links
>   $links = array();
>   foreach (luceneapi_sortable_fields_get($module) as $field => $info) {
>     $options = array();
>     $query = array();
>     $order = '';
> 
>     // if we have a sort type, gets sort params from query string and builds
>     // the query string for the sort link
>     if (NULL !== $info['type']) {
>       if (isset($_GET['lucenesort'][$field])) {
>         $value = $_GET['lucenesort'][$field];
>         $order = ('asc' == $value || SORT_ASC == $value) ? 'asc' : 'desc';
>         $options['attributes']['class'] = 'active';
>       }
>       $query[] = drupal_query_string_encode(array(
>         'lucenesort' => array(
>           $field => (!$order || $order != 'asc') ? 'asc' : 'desc'),
>         )
>       );
>     }
> 
>     // gets the portion of the query string without pager information
>     $exclude = array_merge(array('q', 'page', 'lucenesort'), array_keys($_COOKIE));
>     if ($pager_query = drupal_query_string_encode($_GET, $exclude)) {
>       $query[] = $pager_query;
>     }
> 
>     // adds query string to link options, themes the sort link
>     $title = (isset($info['title'])) ? $info['title'] : $field;
>     $options['query'] = join('&', $query);
>     $links[] = theme('luceneapi_sort_link', $title, $_GET['q'], $options, $order);
>   }
> 
>   return $links;
> }
> 
> /**
962,975c1030
<         return;
<       }
<       if (!$index = luceneapi_index_open($module, $errstr)) {
<         luceneapi_throw_error($errstr, WATCHDOG_ERROR, $module);
<         return;
<       }
<       $links = array();
<       $sort = luceneapi_sortable_fields_get($module);
< 
<       // adds relevancy link
<       if (count($sort)) {
<         $exclude = array_merge(array('q', 'page', 'lucenesort'), array_keys($_COOKIE));
<         $options = array('query' => drupal_query_string_encode($_GET, $exclude));
<         $links[] = theme('luceneapi_sort_link', t('Relevance'), $_GET['q'], $options, $order);
---
>         $content = '';
978,1010c1033
<         return;
<       }
< 
<       // adds sort links
<       foreach ($sort as $field => $info) {
<         $options = array();
<         $query = array();
<         $order = '';
< 
<         // gets order from query string
<         if (isset($_GET['lucenesort'][$field])) {
<           $value = $_GET['lucenesort'][$field];
<           $order = ('asc' == $value || SORT_ASC == $value) ? 'asc' : 'desc';
<           $options['attributes']['class'] = 'active';
<         }
< 
<         // builds sort portion of the query string
<         $query[] = drupal_query_string_encode(array(
<           'lucenesort' => array(
<             $field => (!$order || $order != 'asc') ? 'asc' : 'desc'),
<           )
<         );
< 
<         // gets the portion of the query string without pager information
<         $exclude = array_merge(array('q', 'page', 'lucenesort'), array_keys($_COOKIE));
<         if ($pager_query = drupal_query_string_encode($_GET, $exclude)) {
<           $query[] = $pager_query;
<         }
< 
<         // adds query string to link options, themes the sort link
<         $title = (isset($info['title'])) ? $info['title'] : $field;
<         $options['query'] = join('&', $query);
<         $links[] = theme('luceneapi_sort_link', $title, $_GET['q'], $options, $order);
---
>          $content = theme('luceneapi_sort_list', luceneapi_sort_links_get($module));
1014c1037
<         'content' => theme('luceneapi_sort_list', $links),
---
>         'content' => $content,
1048c1071
<   return theme('item_list', (array)$items);
---
>   return theme('item_list', $items);
