/[drupal]/contributions/modules/apachesolr/apachesolr_search.module
ViewVC logotype

Diff of /contributions/modules/apachesolr/apachesolr_search.module

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph | View Patch Patch

revision 1.1.2.6.2.111.2.28 by robertDouglass, Fri Nov 20 10:24:30 2009 UTC revision 1.1.2.6.2.111.2.29 by robertDouglass, Fri Nov 20 17:13:51 2009 UTC
# Line 1  Line 1 
1  <?php  <?php
2  // $Id: apachesolr_search.module,v 1.1.2.6.2.111.2.27 2009/11/06 10:56:37 robertDouglass Exp $  // $Id: apachesolr_search.module,v 1.1.2.6.2.111.2.28 2009/11/20 10:24:30 robertDouglass Exp $
3    
4  /**  /**
5   * @file   * @file
# Line 422  function apachesolr_search_add_facet_par Line 422  function apachesolr_search_add_facet_par
422        // which won't be used.        // which won't be used.
423        if (apachesolr_block_visibility($query, $module, $delta)) {        if (apachesolr_block_visibility($query, $module, $delta)) {
424          // TODO: generalize handling of date and range facets.          // TODO: generalize handling of date and range facets.
425            // TODO: put field type in the facet definitions.
426          if ($module == 'apachesolr_search' && ($facet_field == 'created' || $facet_field == 'changed')) {          if ($module == 'apachesolr_search' && ($facet_field == 'created' || $facet_field == 'changed')) {
427            list($start, $end, $gap) = apachesolr_search_date_range($query, $facet_field);            list($start, $end, $gap) = apachesolr_search_date_range($query, $facet_field);
428            if ($gap) {            if ($gap) {
# Line 738  function apachesolr_search_block($op = ' Line 739  function apachesolr_search_block($op = '
739    
740          // Handle taxonomy vocabulary facets          // Handle taxonomy vocabulary facets
741          if ((strpos($delta, 'im_vid_') === 0) && module_exists('taxonomy')) {          if ((strpos($delta, 'im_vid_') === 0) && module_exists('taxonomy')) {
742              $facet_query_sorts = variable_get('apachesolr_facet_query_sorts', array());
743    
744            if (is_object($response->facet_counts->facet_fields->$delta)) {            if (is_object($response->facet_counts->facet_fields->$delta)) {
745              $contains_active = FALSE;              $contains_active = FALSE;
746              $terms = array();              $terms = array();
   
747              foreach ($response->facet_counts->facet_fields->$delta as $tid => $count) {              foreach ($response->facet_counts->facet_fields->$delta as $tid => $count) {
748                $options = array('delta' => $delta);                $options = array('delta' => $delta);
749                if ($tid == '_empty_') {                if ($tid == '_empty_') {
# Line 752  function apachesolr_search_block($op = ' Line 753  function apachesolr_search_block($op = '
753                $unclick_link = '';                $unclick_link = '';
754                unset($active);                unset($active);
755                $term = taxonomy_get_term($tid);                $term = taxonomy_get_term($tid);
756                  $sortpre = '';
757                  if (isset($facet_query_sorts['apachesolr_search'][$delta]) && ($facet_query_sorts['apachesolr_search'][$delta] == 'index')) {
758                    $sortpre = $term->name;
759                  }
760                $new_query = clone $query;                $new_query = clone $query;
761                if ($active = $query->has_filter('tid', $tid)) {                if ($active = $query->has_filter('tid', $tid)) {
762                  $contains_active = TRUE;                  $contains_active = TRUE;
# Line 765  function apachesolr_search_block($op = ' Line 770  function apachesolr_search_block($op = '
770                  $link = theme('apachesolr_facet_link', $term->name, $new_query->get_path(), $options, $count, $active, $response->response->numFound);                  $link = theme('apachesolr_facet_link', $term->name, $new_query->get_path(), $options, $count, $active, $response->response->numFound);
771                }                }
772                $countsort = $count == 0 ? '' : 1 / $count;                $countsort = $count == 0 ? '' : 1 / $count;
773                  $countsort += .000001;
774                  $countsort = number_format($countsort, 6);
775                // if numdocs == 1 and !active, don't add.                // if numdocs == 1 and !active, don't add.
776                if ($response->response->numFound > 1 || $active) {                if ($response->response->numFound > 1 || $active) {
777                  $terms[$term->vid][$active ? $countsort . $term->name : 1 + $countsort . $term->name] = $link;                  $terms[$term->vid][$active ? $sortpre . $countsort . $term->name : $sortpre . (1 + $countsort) . $term->name] = $link;
778                }                }
779              }              }
780            }            }

Legend:
Removed from v.1.1.2.6.2.111.2.28  
changed lines
  Added in v.1.1.2.6.2.111.2.29

  ViewVC Help
Powered by ViewVC 1.1.3